|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
User controls and LoadControl methodHi
I need to send parameters to a user control contructor. Is this what the TemplateControl.LoadControl (Type, Object[]) is for? If so can someone show me how to use it please? This is my attempt so far but I get a MissingMethodException - Constructor on type '*' not found. The control would be loaded twice anyway. Hopefully you can see what I'm trying to achieve. Control myCtrl = LoadControl("~/Controls/myCtrl.ascx"); PlaceHolder ph = (PlaceHolder)fv.FindControl("ph"); ph.Controls.Add(LoadControl(myCtrl.GetType(), new object[] { myobj })); ph.Visible = true; Many thanks Andrew Hello Andrew,
If you need to send parameters to a user control, you may consider created customized public property for the user control, and set the property right after you create/load it. Sincerely, Luke Zhang Microsoft Online Community Support This posting is provided "AS IS" with no warranties, and confers no rights.
Can't repopulate DropdownList control during postback?
Query on user control Div background image from CSS NullReferenceException with dynamic DataGrid Custom Control at deisgn time Newbie ASP.NET question for Webportal project Tree view with XML and Populateondemand Slow File Upload Speed IIS 6.0 ASP.net 2.0 How to use .Net controls in regular ASP XPath Asp.net |
|||||||||||||||||||||||