Strange - Clicking Update button doesn’t cause a postback due to <!-- tag
Posted
by AspOnMyNet
on Stack Overflow
See other posts from Stack Overflow
or by AspOnMyNet
Published on 2010-06-02T19:29:27Z
Indexed on
2010/06/02
19:54 UTC
Read the original article
Hit count: 557
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
© Stack Overflow or respective owner