我想在选中checkbox的同时提交到服务器:
*********
问题一
*********
<script language=c# runat=server>
void checkbox1_checkchanged(object sender,eventArgs e)
{
a.Text="ok";
}
</script>
<asp:checkbox id=checkbox1 autopostback=true runat=server/>
<asp:label id=a runat=server/>
当选中checkbox1时,会把label a的字变为“OK”,该怎么做?
*********
问题二
*********
<asp:label id=a visible=false runat=server/>
同样,当选中checkbox1时,将label a的visible改成true,该怎么做?
*********
问题三
*********
筹备中………………
你的问题1、2解答如下:
private void CheckBox1_CheckedChanged(object sender, System.EventArgs e)
{
if(CheckBox1.Checked)
a.Text="ok";
else
a.Text="no";
}
private void CheckBox2_CheckedChanged(object sender, System.EventArgs e)
{
if(CheckBox1.Checked)
b.Visible=false;
else
b.Visible=true;
}
<asp:CheckBox id="CheckBox1" style="Z-INDEX: 112; LEFT: 580px; POSITION: absolute; TOP: 52px" runat="server" AutoPostBack="True"></asp:CheckBox>
<asp:Label id="a" style="Z-INDEX: 113; LEFT: 594px; POSITION: absolute; TOP: 90px" runat="server">Label</asp:Label>
<asp:CheckBox id="CheckBox2" style="Z-INDEX: 114; LEFT: 579px; POSITION: absolute; TOP: 134px" runat="server" AutoPostBack="True"></asp:CheckBox>
<asp:Label id="b" style="Z-INDEX: 115; LEFT: 596px; POSITION: absolute; TOP: 168px" runat="server">Label</asp:Label>