嗨,下面是gridview
rowupdating
事件的代码。为什么要求现场验证器不起作用?
if (string.IsNullOrEmpty(txtKMStart.Text) && string.IsNullOrEmpty(txtKMEnd.Text))
{
RequiredFieldValidator rfvS = new RequiredFieldValidator();
rfvS.ControlToValidate = txtKMStart.ID;
rfvS.ErrorMessage = "Km Start Required!";
RequiredFieldValidator rfvE = new RequiredFieldValidator();
rfvE.ControlToValidate = txtKMEnd.ID;
rfvE.ErrorMessage = "Km End Required!";
ValidationSummary vs = new ValidationSummary();
vs.ShowSummary = false;
vs.ShowMessageBox = true;
}
和gridview在
之下<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
AutoGenerateEditButton="True"
BackColor="White" BorderColor="#336666"
BorderStyle="Double" BorderWidth="3px"
CellPadding="4" GridLines="Horizontal" onrowcancelingedit="GridView1_RowCancelingEdit"
onrowdatabound="GridView1_RowDataBound"
onrowediting="GridView1_RowEditing" DataKeyNames="Sno"
onrowupdating="GridView1_RowUpdating" AllowPaging="True"
onpageindexchanging="GridView1_PageIndexChanging" PageSize="15">
</asp:GridView>