User1724605321 posted
Hi Sixthsense,
To ensure that the user enters required inputs in a correct format in the inserting interface of the DetailView Control, you should convert the BoundFields into TemplateFields and add the Validation Controls to the appropriate template(s). For example :
<asp:DetailsView runat="server" ID="userDetails">
<Fields>
<asp:TemplateField>
<InsertItemTemplate>
<asp:TextBox runat="server" ID="userName" />
<asp:RequiredFieldValidator runat="server" ID="userNameValidator"
ErrorMessage="Please enter the name" ControlToValidate="userName" />
</InsertItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
Please refer to below articles for details and demo :
http://jennycoca.blogspot.sg/2012/02/validate-dataview-control-aspnet-c.html .
https://msdn.microsoft.com/en-us/library/bb426882.aspx
Best Regards,
Nan Yu