Monday 15 September 2014

asp.net - Master UserControl -


I used the code which was placed by Alexander:

I have a question on this code is. How can I access control (like ListBox) I have the Master Control 1 of Hair Control 1?

The way I have always done that is to expose the controls through a method.

So if you want to access the listbox, create a method like this in the Master User Control:

  Public list box GetListBox () {return this.myListBox; }   

Because it is a bit different from the masterpage, so with child control you have to do the following:

  var master = (MasterControl1) Page LoadControl (this.MasterControlVirtualPath); Var Masterlistbox = Master. Getlistbox ();    

No comments:

Post a Comment