Clicking DetailsView’s Update button doesn’t cause a postback

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:34 UTC
Read the original article Hit count: 610

Filed under:

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>

But if I remove CompareValidator control from the above code, 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>
</EditItemTemplate>

Any idea why page doesn't get posted back?

thanx

© Stack Overflow or respective owner

Related posts about ASP.NET