c# - How to validate gridview for emptiness through the custom validator? -
how validate gridview emptiness through custom validator
:
<asp:customvalidator id="customvalidator1" runat="server" errormessage="!!! " controltovalidate="gridview1" validationgroup="add_valid" onservervalidate="customvalidator1_servervalidate"></asp:customvalidator>
protected void customvalidator1_servervalidate(object source, servervalidateeventargs args) { }
try this..
protected void customvalidator1_servervalidate(object source, servervalidateeventargs args) { if(yourgridviewid.rows.count<1) args.isvalid=false; }
Comments
Post a Comment