visible property of server controls.??

Results 1 to 3 of 3

Thread: visible property of server controls.??

  1. #1
    Join Date
    Dec 1969
    Posts
    55

    Default visible property of server controls.??

    Hi <BR>I got a small question..i have 2 dropdown boxes in my webpage..in the first dropdown the options are select.., yes,no...if the user selects yes then only the second dropdown has to be visible..all other cases it has to be invisible..i am writing the sode like this in page load..its not working..if any body have idea pls help me..<BR><BR>if(gold1.selectedindex==1)<BR>{<BR> gold2.visible=true;<BR>}<BR>else<BR>{<BR> gold2.visible=false;<BR>}<BR><BR>Thank you<BR>Satya

  2. #2
    Join Date
    Dec 1969
    Posts
    18,177

    Default Debug your SelectedIndex.

    I believe the first option in the list will have an index of 0 (not 1) and go from there.

  3. #3
    Join Date
    Dec 1969
    Posts
    55

    Default RE: Debug your SelectedIndex.

    Hi<BR>The problem is not that..if i wrote the code in button_click its working..if just change the selected item in first dropdown its not working<BR><BR>//this is working<BR><BR>private void Button1_Click(object sender, System.EventArgs e)<BR> {<BR> <BR> if(dropcontr.SelectedIndex==0)<BR> {<BR> contyrs.Visible=true;<BR> Label3.Visible=true;<BR> <BR> }<BR> else<BR> {<BR> Label3.Visible=false;<BR> contyrs.Visible=false;<BR> <BR> }<BR><BR> <BR> <BR> }<BR><BR><BR><BR><BR><BR><BR>i dont want button click..each and every time..bcz i have to do this for almost 50 controls in my form..so i am writing the code in page load..thats not working<BR><BR> if(dropcontr.SelectedIndex==0)<BR> {<BR> contyrs.Visible=true;<BR> Label3.Visible=true;<BR> <BR> }<BR> else<BR> {<BR> Label3.Visible=false;<BR> contyrs.Visible=false;<BR> <BR> }<BR><BR>please give me idea abt this<BR><BR>Thank you<BR>Satya

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •