문제

How to validate the gridview for emptiness through the 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;
  }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top