Validation of a field inside a detailsview does not need to be done with the Updating or Editing events, but can be accomplished by a simple validation control in the markup language. Convert the field in the detailsview to a template field, and use a standard validation control.
<asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Numeric input required" Operator="DataTypeCheck" Type="Double" ControlToValidate="TextBox2"> </asp:CompareValidator>
And applied to a data bound field:
<asp:TemplateField HeaderText="Cost amount" SortExpression="wsCostAmount"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("wsCostAmount") %>'></asp:TextBox> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Numeric input required" Operator="DataTypeCheck" Type="Double" ControlToValidate="TextBox2"></asp:CompareValidator> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("wsCostAmount") %>'></asp:TextBox> <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="Numeric input required" Operator="DataTypeCheck" Type="Double" ControlToValidate="TextBox2"> </asp:CompareValidator> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("wsCostAmount") %>'></asp:Label> </ItemTemplate>