Click here to Skip to main content
15,903,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
whenever i select student the roll number text box gets visible,but the glitch is when i go back and change the drop down list value to something else again,both the roll number and employee id text box become visible.can somebody please help me out.i'll be ever so greatfull.



C#
protected void DropDownListdes_SelectedIndexChanged(object sender, EventArgs e)
   {
       Label1.Text = DropDownListdes.SelectedItem.ToString();
       if (Label1.Text == "student")
       {
           Labelyr.Visible = true;
           DropDownListyr.Visible = true;
           Labelroll.Visible = true;
           collegerollno.Visible = true;

       }
       else if (Label1.Text == "principal")
       {

           DropDownListdept.Items[3].Enabled = true;
           LabelEID.Visible = true;
           TextBoxEID.Visible = true;
       }
       else
       {
           LabelEID.Visible = true;
           TextBoxEID.Visible = true;
       }
Posted
Comments
Member 10344895 18-Oct-13 13:48pm    
i am very sorry for the inconvenience,if anyone has tried helping me out.but i have solved the problem and there is no need for any further assistance.thank you.
ZurdoDev 18-Oct-13 15:21pm    
All you need to do is step through the code and debug it.
ZurdoDev 18-Oct-13 15:22pm    
I just noticed your comment. You should post it as a solution so that it no longer shows in unanswered.

1 solution

Hi,

You have to set Visible/Enabled property in each condition for all the controls.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900