Is there a way to get the ClientIDMode and ClientID properties on ASP.NET 3.5?

I would like to have a brand new property ClientIDModeand ClientIDon ASP.NET 3.5 controls, is there any way I can achieve this?

I was thinking of replacing the default control compiler, is this possible or are there many changes to make this behavior available?

+3
source share
1 answer

If you just want a ClientIDMode.Staticcontrol ID above you can use the following workaround:

HtmlGenericControl p = new HtmlGenericControl("p");
p.Attributes.Add("id", "myParagraph");
this.Controls.Add(p);

prints:

<p id="myParagraph"></p>
-1
source

Source: https://habr.com/ru/post/1748522/


All Articles