P
Padam
I created a user conrolt in C# and want to create multiple instance (one by
one) of usercontrol onclick of button. if i hard code in .aspx page like
<%@ Register Src="~/UserControls/AddPhaseMilestone.ascx"
TagName="AddPhaseMilestone" TagPrefix="uc1" %>
<uc1:AddPhaseMilestone ID="AddPhaseMilestone1" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone2" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone3" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone4" EnableViewState="true"
runat="server" />
it works fine. I have to do in codebehind using click event to button. Pls
do suggest me how to do that. I tried below mention code but it is not
solving my problem.
Control oControl = Page.LoadControl("~/UserControls/AddPhaseMilestone.ascx");
//oControl.ID = "fajkla";
//PlaceHolder1.Controls.Add(oControl);
//div.Controls.Add(oControl);
Page.Controls.Add(oControl);
one) of usercontrol onclick of button. if i hard code in .aspx page like
<%@ Register Src="~/UserControls/AddPhaseMilestone.ascx"
TagName="AddPhaseMilestone" TagPrefix="uc1" %>
<uc1:AddPhaseMilestone ID="AddPhaseMilestone1" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone2" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone3" EnableViewState="true"
runat="server" />
<uc1:AddPhaseMilestone ID="AddPhaseMilestone4" EnableViewState="true"
runat="server" />
it works fine. I have to do in codebehind using click event to button. Pls
do suggest me how to do that. I tried below mention code but it is not
solving my problem.
Control oControl = Page.LoadControl("~/UserControls/AddPhaseMilestone.ascx");
//oControl.ID = "fajkla";
//PlaceHolder1.Controls.Add(oControl);
//div.Controls.Add(oControl);
Page.Controls.Add(oControl);