I have a Check Box in my asp page. Once I clicked on it, the page display (visible = true
) a table id='xx'. This table has two rows. A Dropdown and a Lable.
<table>
<tr>
<td colspan='2'>
<asp:CheckBox runat="server" ID="CheckBox1" Text="check" Checked="true" AutoPostBack="true"
OnCheckedChanged="CheckBox1_CheckedChanged" />
<table id='xx' runat="server">
<tr>
<td colspan='2'>
Student Information :
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Select Student name :"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" Width="200px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Select Student name :"></asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
this.xx.Visible = CheckBox1.Checked;
}
Once user change the selected drop Down value The label value should change.
ex: If user select 'City' in Drop down the Label2.text = Dropdown.selectedvalue
.
I have used AutoPostBack="true"
for all Check Box control and Drop down while postback.
Issue scenario:
Please help me to display change value On label2 once user has changed the value on Drop down without non-visibling the table.
Thank you.
Do this on your Page_Load Event:
this.xx.Visible = CheckBox1.Checked;