ajaxtoolkit:ValidatorCalloutExtender grid view asp.net
can i use ajaxtoolkit:ValidatorCalloutExtender to validate zero rows o开发者_如何学JAVAf a grid view
You can use the ValidatorCalloutExtender
to extend a CustomValidator
that has the logic for validating the zero rows Gridview.
Markup
<asp:GridView ID="gv" runat="server" />
<asp:CustomValidator ID="cvGridView" runat="server" Text="0 Rows" Display="Dynamic"
OnServerValidate="cvGridView_ServerValidate"></asp:CustomValidator>
<ajaxtoolkit:validatorcalloutextender runat="Server" id="vceGridView"
targetcontrolid="cvGridView" />
Codebehind
protected void cvGridView_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = gv.Rows.Count > 0;
}
精彩评论