Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Controls
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00875886
Message ID:
00876099
Views:
14
Hi Valentin,

To add a UserControl to a PlaceHolder, you use the Add method of the placeholder. Here is an example:
UserControl ucControl1 = (UserControl)LoadControl("WebUserControl1.ascx"); 
PlaceHolder phPlaceHolder = (PlaceHolder)this.FindControl("Form1").FindControl("PlaceHolder1");
phPlaceHolder.Controls.Clear(); 
phPlaceHolder.Controls.Add(ucControl1); 
>Hello everybody,
>I made user control (datagrid) which I want to load dynamicaly into placeholder object. It seems to me that it does not accepts parameters or I just siply don't know how to do it properly.
>Please help.
>
>Here is code I use for it:
>{
>control ctlGrid;
>string ms = "MainGrid.ascx?Report=" + ddReports.SelectedItem.Value;
>ctlGrid = LoadControl(ms);
>ph.Controls.Add(ctlGrid);
>}
>
>I do need to pass Report parameter into it.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform