本文介绍了错误:仅包含内容控件的内容页面中直接允许包含内容控件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%@ Page Language="C#" MasterPageFile="~/UserPage.master" AutoEventWireup="true" CodeFile="Signup.aspx.cs" Inherits="Signup" %>
<html xmlns="http://www.w3.org/1999/xhtml"/>
<head runat="server">
<script type="text/javascript" language ="javascript">
function getSelectValue(sel) {
var val;
// only if there is a selected item
if (sel.selectedIndex > -1) {
// get the value from the select element
val=sel.options[sel.selectedIndex].value;
// alert(val);
}
return val;
}
function ddlChange(DropDownID,TextBoxID)
{
var c=document.getElementById(DropDownID);
var div=document.getElementById(TextBoxID);
if(getSelectValue(c)=='108')
{
div.value='';
div.style.visibility="visible";
if (div.Validators&&div.Validators.length) {
for (var i=0; i<div.Validators.length; i++)
ValidatorEnable(div.Validators[i], true)
}
}
else
{
div.value='108';
div.style.visibility="hidden";
if (div.Validators&&div.Validators.length) {
for (var i=0; i<div.Validators.length; i++)
ValidatorEnable(div.Validators[i], false)
}
}
}
</script>
</head>
<asp:Content ID="Content1" runat="server"
contentplaceholderid="ContentPlaceHolder1"/>
</html>
先生,
我遇到此错误,即:仅包含内容控件的内容页面中直接允许内容控件.
谢谢.
[edit]忽略HTML ..."选项已禁用-OriginalGriff [/edit]
</html>
Hi Sir,
I am facing this error, i.e: Only Content controls are allowed directly in a content page that contains content controls.
Thanks.
[edit]"Ignore HTML..." option disabled - OriginalGriff[/edit]
推荐答案
<![CDATA[<%@ Page Language="C#" MasterPageFile="~/Resources/Masters/OverAll.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
<![CDATA[<%@ MasterType VirtualPath="~/Resources/Masters/OverAll.master" %>
<asp:content id="ContentHead" contentplaceholderid="pageHead" runat="Server" xmlns:asp="#unknown">
<!-- Empty - emergencies only, at top of page. -->
<asp:content id="ContentBody" contentplaceholderid="cphBody" runat="Server" xmlns:asp="#unknown">
<script type="text/javascript" language="javascript">
function getSelectValue(sel) {
var val;
// only if there is a selected item
if (sel.selectedIndex > -1) {
// get the value from the select element
val = sel.options[sel.selectedIndex].value;
// alert(val);
}
return val;
}
function ddlChange(DropDownID, TextBoxID) {
var c = document.getElementById(DropDownID);
var div = document.getElementById(TextBoxID);
if (getSelectValue(c) == '108') {
div.value = '';
div.style.visibility = "visible";
if (div.Validators && div.Validators.length) {
for (var i = 0; i < div.Validators.length; i++)
ValidatorEnable(div.Validators[i], true)
}
}
else {
div.value = '108';
div.style.visibility = "hidden";
if (div.Validators && div.Validators.length) {
for (var i = 0; i < div.Validators.length; i++)
ValidatorEnable(div.Validators[i], false)
}
}
}
</script>
[edit]显示在内容块中的脚本样本-OriginalGriff [/edit]
将pre块的[lang2]设置为htm以改善显示-OriginalGriff [/edit2]
[edit]Script sample shown in content block - OriginalGriff[/edit]
[edit2]"lang" of pre block set to htm to improve display - OriginalGriff[/edit2]
这篇关于错误:仅包含内容控件的内容页面中直接允许包含内容控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!