i have a web form in to which i load a web user control(A)
an when a button on control A is clicked it loads an array of another web user control named as infobox
when i add the user control in to control collection of web user control A it does not show.
below is the code: on button click of control A
foreach (Categories category in CategoriesDataList)
{
InfoBox ib = new InfoBox();
ib.LiteralName = category.Category_Name;
span_tempList.Controls.Add(ib);
ib = null;
}
span_tempList is a `<span>` tag with `runat=server`
below i HTML and cs Code for InfoBox Control
public partial class InfoBox : System.Web.UI.UserControl
{
protected global::System.Web.UI.WebControls.Label ltrlName = new System.Web.UI.WebControls.Label();
protected void Page_Load(object sender, EventArgs e)
{
}
public InfoBox()
{
}
public string LiteralName
{
get { return ltrlName.Text; }
set { ltrlName.Text = value; }
}
}
--HTML--
<div style="width:10%;float:left;">
<asp:Label ID="ltrlName" runat="server" Text="Label"></asp:Label>
</div>
<div style="width:20%;float:left;">
<asp:Image ID="imgPicture" runat="server" ImageUrl="" />
</div>
<div style="width:70%;float:right;">
</div>
also tried to add controls to page doesn't works