views:

19

answers:

2

Hi, Im making a small user control, i was wondering if it was possible to make some sort of comment, that is only visible design 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,

+1  A: 

Yes, using a ControlDesigner Class.

Edit: You can also use

protected override void Render(HtmlTextWriter writer)
{
  if (this.DesignMode)
  {
    ...
    return;
  }
  ...
}
Jaroslav Jandek
+1  A: 

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.

XIII