This project is read-only.

Remove website and Notify Me checkbox when adding comment

Oct 16, 2009 at 6:25 PM


I want to remove the Website textbox and the checkbox for notifying me for new comments. When I try to comment them out or even set them to visible=false, whenever I hit the button to add a comment or even if I click on the live preview I just get the spinning blue circle and nothing ever happens.

Any idea how I can remove these elements?


Oct 17, 2009 at 2:24 AM

Instead of setting visible to false, you can wrap each part into DIV tags with their display CSS property set to none.  The controls will still get sent to the browser, but they won't be visible.

Also, for the Website, you should also delete (or maybe just disable) the RegularExpressionValidator control.

<div style="display:none;">
      <label for="<%=txtWebsite.ClientID %>">< %></label>
      <asp:TextBox runat="Server" ID="txtWebsite" TabIndex="4" ValidationGroup="AddComment" />
      <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="Server" ControlToValidate="txtWebsite" ValidationExpression="(http://|https://|)([\w-]+\.)+[\w-]+(/[\w- ./?%&=;~]*)?" ErrorMessage="<%$Resources:labels, enterValidUrl %>" Display="Dynamic" ValidationGroup="AddComment" /><br />
<div style="display:none;">
      <input type="checkbox" id="cbNotify" style="width: auto" tabindex="7" />
      <label for="cbNotify" style="width:auto;float:none;display:inline"><%=Resources.labels.notifyOnNewComments %></label><br /><br />