开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜