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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -