I want to add some controls to my form dynamically.
in html side:
<asp:Literal ID="Literal_news" runat="server"></asp:Literal>
my code in c# (code behind) is like below:
string str_contxt = "hi dear user!";
img2.ImageUrl = "~/images/a.jpg";
Literal_news.Text += "<article style=\"position: relative; height: 300px; opacity: 1;\"> <div class=\"banner-wrap\"> <div class=\"slider-left\"> <img src =\" " + img2.ImageUrl + " \" alt=\"\"/> </div> <div class=\"slider-left\"> <asp:Label ID=\"Label1\" runat=\"server\" Text=\" " + str_contxt + " \"></asp:Label> </div> <div class=\"clear\"></div></div></article> ";
the image is shown correct (img2.ImageUrl
), but the text isn't shown(str_contxt
). what is the problem ?
{I used label instead of literal control. but the problem didn't solve.}