forum

home / developersection / forums / adding user controls from code behind

Adding User Controls from code behind

Anonymous User 1876 29-Sep-2014

I have a user control(UserControl1) on my page and one Add more button.Clicking on Add More Button add the same user control again.When i click on user control first time,it adds second User Control,but on second time it doesnot add other.I think the control gets lost. I am adding a control like this on link button click:- 

protected void lnkadd_Click(object sender, EventArgs e)
{
    HtmlTableCell tCell = new HtmlTableCell();
    UserControl uc = (UserControl)Page.LoadControl("~/Controls/DirectionalPricingCtrl.ascx");
    tCell.Controls.Add(uc);
    tablerow.Cells.Add(tCell);
}


.net c# 
Updated on 29-Sep-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By