HtmlGenericControl ID Property is not specified – ASP.Net (Visual Studio)

4

You would see this quite often in Visual Studio (mainly 2008) while working with ASP.Net and User Controls. This is been very tricky. It is not actually a problem, but Visiual Studio could not render this control inside another page. It was kind of a pain not being able to see User control inside main pages. It took a while to figure it out.

If you are using HtmlGeneric controls (such as <body>, <div>, <span>, <p>, <link> etc) in your User Control they must have ‘ID’ attribute defined though you are not using it.

For example we had


<link href="~/App_Themes/Default/Default.css" runat="server" rel="stylesheet" type="text/css" />

All I need to do was add ‘id’ attribute to this tag as

<link href="~/App_Themes/Default/Default.css" runat="server" rel="stylesheet" type="text/css" id="dummy"/>

Cheers!

4 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here