Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User Controls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00875886
Message ID:
00876099
Vues:
12
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform