How to assign css style to dynamic control,solution is here.
Here i am showing how can we display textual content in runtime created
table and also we can use css class for this runtime created table tr and td.
Steps:
1.Take a div in html page as given below
<div class="msg" id="divOut" runat="server">
2.Write below code in .cs file
if (Convert.ToString(Convert.ToString(Session["userid"]) =="2511")
{
divOut.Controls.Add(new LiteralControl("<table align='center'>"));
divOut.Controls.Add(new LiteralControl("<tr><td align='left'>This is a messsage for userid 2511."));
divOut.Controls.Add(new LiteralControl("</td></tr>"));
divOut.Controls.Add(new LiteralControl("<tr><td align='left'> you can write you message here."));
divOut.Controls.Add(new LiteralControl("</td></tr>"));
divOut.Controls.Add(new LiteralControl("</table>"));
}
else if (Convert.ToString(Session["userid"]) == "2641")
{
divOut.Controls.Add(new LiteralControl("<table align='center'>"));
divOut.Controls.Add(new LiteralControl("<tr><td class='HighlightsmallnormalBlack' align='center'>This is a messsage for userid 2511!"));
divOut.Controls.Add(new LiteralControl("</td></tr>"));
divOut.Controls.Add(new LiteralControl("</table>"));
}
Regards
Santosh Singh