forum

Home / DeveloperSection / Forums / creating html div in c#

creating html div in c#

Manoj Bhatt 1995 29-Aug-2014

I am using the following code to make an html div in c#

System.Web.UI.HtmlControls.HtmlGenericControl dynDiv =
        new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
            dynDiv.ID = "dynDivCode";
            dynDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "Gray");
            dynDiv.Style.Add(HtmlTextWriterStyle.Height, "20px");
            dynDiv.Style.Add(HtmlTextWriterStyle.Width, "300px");
            dynDiv.InnerHtml = "I was created using Code Behind";
            this.Controls.Add(dynDiv);

But this does not do a thing, it gives an error at the last line that dynDiv is not a valid argument.

 I want to use div here to simulate cache memory line and placement of words in cache memory

.Please tell me how to do it


c# c# 
Updated on 01-Sep-2014

Can you answer this question?


Answer

1 Answers

Liked By