如何在asp.net的gridview中对行进行必要的字段验证器验证? [英] how to do required field validator validation for rows in a gridview in asp.net?
本文介绍了如何在asp.net的gridview中对行进行必要的字段验证器验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好!朋友我有telric gridview控件和这个letric gridview文本框已被用于插入记录,现在有四列我必须采取所有文本框所需的字段验证器任何文本框未填充消息应显示在上面的telric gridview就像汇总验证器说所有填充应该归档但请提供完整的代码..
Hello! friend i have telric gridview control and this this letric gridview textboxes have been taken for inserting the record and there is four column now i have to take required field validator for the all textbox any textbox is not filled a message should display on the above of the telric gridview like summary validator saying 'All the filled should be filed ' but please provide me the complete code..
推荐答案
使用模板列并为每个控件添加RequiredFieldValidator。
Use template columns and add RequiredFieldValidator for each control.
<itemtemplate>
<div dir="rtl" style="text-align: center">
<asp:radiobuttonlist id="RBL_Yes_NO0" runat="server" repeatdirection="Horizontal" xmlns:asp="#unknown">
Width="200px">
<asp:listitem value="1">yes</asp:listitem>
<asp:listitem value="0">No</asp:listitem>
</asp:radiobuttonlist>
<table style="width: 100%">
<tr>
<td align="center" dir="rtl">
الرصيد الكلي
</td>
<td align="center" dir="rtl">
<telerik:radtextbox id="RadTxtBtotalVac" runat="server" width="100px" emptymessage="الرصيد الكلي للموظف" xmlns:telerik="#unknown">
ValidationGroup='<%# Eval("IDMain") %>'>
</telerik:radtextbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" controltovalidate="RadTxtBtotalVac" xmlns:asp="#unknown">
ErrorMessage="*" ValidationGroup='<%# Eval("IDMain") %>'
SetFocusOnError="True">
</asp:requiredfieldvalidator>
</td>
</tr>
<tr>
<td align="center" dir="rtl">
الرصيد المتمتع به
</td>
<td align="center" dir="rtl">
<telerik:radtextbox id="RTxtBVacation_used" runat="server" width="100px" validationgroup="sendVacation" xmlns:telerik="#unknown">
</telerik:radtextbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" controltovalidate="RTxtBVacation_used" xmlns:asp="#unknown">
ErrorMessage="*" ValidationGroup='<%# Eval("IDMain") %>'>
</asp:requiredfieldvalidator>
</td>
</tr>
</table>
</div>
</itemtemplate>
这篇关于如何在asp.net的gridview中对行进行必要的字段验证器验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文