ASP.NET - Create a DIV Tag using C# | Coding Cluster - using, c#, mvc 4, iphone, php, ios, javascript, in mvc 3 & more

ASP.NET - Create a DIV Tag using C#


Create div tag dynamically in ASP.NET using c# :
           Below is the sample (c#) code for create  a div tag in The following code will give out put like this...

Code for create dynamic div in ASP.NET using csarp:
protected void Page_Load(object sender, EventArgs e)
        System.Web.UI.HtmlControls.HtmlGenericControl createDiv =
        new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");      
        createDiv.ID = "createDiv";
        createDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Yellow");
        createDiv.Style.Add(HtmlTextWriterStyle.Color, "Red");
        createDiv.Style.Add(HtmlTextWriterStyle.Height, "100px");
        createDiv.Style.Add(HtmlTextWriterStyle.Width, "400px");
        createDiv.InnerHtml = " I'm a div, from code behind ";


Anonymous said...

my self Ankish Saini from India

Thanks a lot its working fine.
Can u help me, i want to add a div on every button click, means a unique div.
please help me.....thanks in advance.

Post a Comment

Share your thoughts here...




Blogger Widgets