c# - No control created on page_load -
i have asp page containing 2 radio buttons , other textbox , labels. things have make of them disapear (not visible) when radio button selected.
i thought using controlcollection , adding control need make invisible it. had them controlcollection, disapear web page. have no idea why.
c# code :
private void creategroup() {     controlcollection cc = createcontrolcollection();     cc.add(txt1);     cc.add(txt2);     // , on... }   if call function on page_load() event, no control on page.
thanks
have tried setting visible=false each control in radio button selection handler?
  void yourradiobutton_checkchanged(object sender, eventargs e)    {       txt1.visible = !yourradiobutton.checked;      txt2.visible = !yourradiobutton.checked;      // , on...    }   if want create collections of controls in page load ease manipulation, create list<webcontrol>.
list<webcontrol> yourcontrols = new list<webcontrol>(); //...  protected void page_load(object sender, eventargs e) {     yourcontrols.add(txt1);     yourcontrols.add(txt2);     // , on...  }      
Comments
Post a Comment