<script language="c#" runat="server">
void chkLayout_CheckedChanged(Object sender,EventArgs e){
if( chkLayout==true ){//第十行
MyLover.RepeatLayout = RepeatLayout.Table;
}
else{
MyLover.RepeatLayout = RepeatLayout.Flow;
}
}
</script>
<body>
<form runat="server">
<asp:CheckBoxList id="MyLover"
runat="server"/>
<asp:ListItem>范冰冰</asp:ListItem>
<asp:ListItem>张柏芝</asp:ListItem>
<asp:ListItem>梁咏琪</asp:ListItem>
<asp:ListItem>张曼玉</asp:ListItem>
<asp:ListItem>梅艳芳</asp:ListItem>
<asp:ListItem>张国荣</asp:ListItem>
</asp:CheckBoxList>
<br>jjjj
<br>
<asp:CheckBox id="chkLayout" OnCheckedChanged="chkLayout_CheckedChanged" AutoPostBack="true" Text="显示表格布局" Checked="True"></asp:CheckBox>
<br>
<asp:CheckBox id="chkDirection" OnCheckedChanged="chkDirection_CheckedChanged" Text="水平显示"></asp:CheckBox>
</form>这一个会提示错误:
第十行 The name 'chkLayout' does not exist in the class or namespace 'ASP.test_aspx'
void chkLayout_CheckedChanged(Object sender,EventArgs e){
if( chkLayout==true ){//第十行
MyLover.RepeatLayout = RepeatLayout.Table;
}
else{
MyLover.RepeatLayout = RepeatLayout.Flow;
}
}
</script>
<body>
<form runat="server">
<asp:CheckBoxList id="MyLover"
runat="server"/>
<asp:ListItem>范冰冰</asp:ListItem>
<asp:ListItem>张柏芝</asp:ListItem>
<asp:ListItem>梁咏琪</asp:ListItem>
<asp:ListItem>张曼玉</asp:ListItem>
<asp:ListItem>梅艳芳</asp:ListItem>
<asp:ListItem>张国荣</asp:ListItem>
</asp:CheckBoxList>
<br>jjjj
<br>
<asp:CheckBox id="chkLayout" OnCheckedChanged="chkLayout_CheckedChanged" AutoPostBack="true" Text="显示表格布局" Checked="True"></asp:CheckBox>
<br>
<asp:CheckBox id="chkDirection" OnCheckedChanged="chkDirection_CheckedChanged" Text="水平显示"></asp:CheckBox>
</form>这一个会提示错误:
第十行 The name 'chkLayout' does not exist in the class or namespace 'ASP.test_aspx'
解决方案 »
- 为什么说在对大型集合进行循环访问的情况下,装箱和取消装箱的影响非常明显。
- 谁帮我看看
- 根据GridView的DataSource显示数据
- 100分求购一个“百度指数邀请码”!!
- UpdatePanel控件中不能放至具有Visible属性的控件
- 最后30分了,当一个DataGrid的cell变成文框的时候,我想给这个cell的onfocus添加JavaScript可以吗?
- 急啊!.net关于弹出alert的问题
- datagrid模板列显示文字的行距!
- 事件委托的问题,各位帮我看看!
- 是不是教程有错?
- 急,请教一下,如果用流将文件下载下来。我想下载一个.swf的文件或是图片入座。知道该文件的url,我应该如果用流式方法把这个文件下载下
- btnxxx_Click为什么不行,但在控件上加onclick="xxxx"就行?
The type or namespace name 'chkLayout' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'chkLayout' could not be found (are you missing a using directive or an assembly reference?)
在写ASP.Net中的空间的时候,一定不要忘了runat="server"
因为ASP.Net中有两种类型的控件一是HTML Server Control 一是Web Server Control,通过名字我们也可以看出 server第一个错误chkLayout==true ,哎,我经常犯的:)
<asp:CheckBoxList id="MyLover"
runat="server"/> //不能加 "/"
<asp:ListItem>范冰冰</asp:ListItem>
<asp:ListItem>张柏芝</asp:ListItem>
<asp:ListItem>梁咏琪</asp:ListItem>
<asp:ListItem>张曼玉</asp:ListItem>
<asp:ListItem>梅艳芳</asp:ListItem>
<asp:ListItem>张国荣</asp:ListItem>
</asp:CheckBoxList>
<asp:ListItem value="范冰冰">范冰冰</asp:ListItem>
<asp:ListItem value="张柏芝">张柏芝</asp:ListItem>
<asp:ListItem value="梁咏琪">梁咏琪</asp:ListItem>
<asp:ListItem value="张曼玉">张曼玉</asp:ListItem>
<asp:ListItem value="梅艳芳">梅艳芳</asp:ListItem>
<asp:ListItem value="张国荣">张国荣</asp:ListItem>
</asp:CheckBoxList>