Strange - Clicking Update button doesn’t cause a postback due to <!-- tag
- by AspOnMyNet
If I define the following template inside DetailsView, then upon clicking an Update or Insert button, the page is posted back to the server:
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox>
<asp:CompareValidator ID="valDateType" runat="server" ControlToValidate="txtDate" Type="Date" Operator="DataTypeCheck" Display="Dynamic" >*</asp:CompareValidator>
</EditItemTemplate>
If I remove CompareValidator control from the above code by simply deleting it, then page still gets posted back.But if instead I remove CompareValidator control by enclosing it within <!-- --> tags, then for some reason clicking an Update or Insert button doesn’t cause a postback...instead nothing happens:
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox>
<!-- <asp:CompareValidator ID="valDateType" runat="server" ControlToValidate="txtDate" Type="Date" Operator="DataTypeCheck" Display="Dynamic" >*</asp:CompareValidator> -->
</EditItemTemplate>
</EditItemTemplate>
Any idea why page doesn't get posted back?
thanx