Hi, In my webform controls like this
Checkbox 1:yes and checkbox2 :No
Name: TextBox
FirstName:TextBox
LastName: TextBox
State: ComboBox
If I click yes ,The Controls changes like this(same page)
Name:comboxBox
FirstName:TextBox
LastName:ComboxBox
State:TextBox
Nilanka DharmadasaPosted Nov 13, 2009, 12:21 AM
First you should add following controls to your user cntrol desinger.
For Name : 1 TextBox, 1 combo box (Let's say textbox1 and combobox1)
For FirstName: 1 TextBox (let's say, textbox2)
For LastName: 1 TextBox, 1 combo box (Let's say textbox3 and combobox3)
For State: TextBox 1 (let's say, textbox2)
When you drag the controls to the designer, drag them so that, the locations of combobox1 and textbox1 are same. And aslo the locations of combobox3 and textbox3 are same.
Then in the designer,
set combobox1 and combobox3 to, visible = false
Then in the checked_changed event of your check box 1, write following code.
If(checkbox1.Checked)
{
//Yes is checked
textbox1.Visible = false;
textbox3.Visible = false;
combobox1.Visible = true;
combobox2.Visible = true;
}
else
{
//Yes is unchecked
textbox1.Visible = true;
textbox3.Visible = true;
combobox1.Visible = false;
combobox2.Visible = false;
}
If you have any problem pls ask.
If you find this useful, pls mark this as accepted.