ASP.NET usercontrol, is it possible to have a design time comment?
Im making a small user control, i was wondering if it was possible to make some sort of comment, that is only visible design开发者_Go百科 time. For example i would like to write in the top of my control that it requires a querystring parameter named userid. This way other developers can quickly see the requirements?
cheers,
In markup use:
<%-- Your comment --%>
Or write this:
<% if (this.DesignMode) {%>
Some informative text
<% } %>
I tested that last one out in a test project. When I drag & drop a user control containing that code I get to see it (VS2010) and when I run it there's no trace whatsoever in the generated html.
Yes, using a ControlDesigner Class.
Edit: You can also use
protected override void Render(HtmlTextWriter writer)
{
if (this.DesignMode)
{
...
return;
}
...
}
精彩评论