how to dinamically add controls in asp.net Dynamic Data
- by loviji
Hello, i'm trying to work with asp.NET Dynamic Data. So, I see Dynamic Data not well learned by people as other technologies.
now, to my question. Lets us work with Details.aspx page that located on ~\DynamicData\PageTemplates I need to add <asp:DynamicControl runat="server" to page into Form1.detailsTable.
i've tried like this:
protected DynamicControl myC=new DynamicControl();
protected void Page_Load(object sender, EventArgs e)
{
foreach(var c in table.Columns)
{
myC.DataField=c.DisplayName;
FormView1.Controls.Add(myC);
}
}
but I can not see the desired result. where is the problem. thanks