Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

adding control dynamically

  Asked By: Lourdes    Date: Apr 10    Category: Asp.net    Views: 900
  

im creating datagrid dynamically.
then i add it to the page:
//add datagrid to the page

Page.Controls[1].Controls.Add(dg);

how can i "tell" where to put it on the page.

i have a page with several tables and i want that the datagrid will be inside
one of the tables.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Kerry Wright     Answered On: Apr 10

Put a label into the spot where you want it to go, add  the label to your
backend code as a reference and then do..

labelID.Controls.add(dg);

 
Answer #2    Answered By: Miriam Green     Answered On: Apr 10

plcBullseye.Controls.Add(dg);


<Asp:Placeholder id="plcBullseye" runat="server" />

Find control  can also help see:
www.learnasp.com/freebook/learn/controlsadd.aspx

 
Didn't find what you were looking for? Find more on adding control dynamically Or get search suggestion and latest updates.




Tagged: