Required Field validator in grid view
I have one dynamic grid. In that amount and date are not null columns.
<asp:TemplateField>
<ItemTemplate>
<asp:RequiredFieldValidator开发者_如何转开发 ID="reqAmount" runat="server"
ControlToValidate="txtAmount" Display="None" InitialValue=""
Visible="true" ValidationGroup="req" SetFocusOnError="true">
</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
The user should enter something in the specified columns. My issue is that if the save button is pressed the required validator is firing for all the rows that are empty. It should only show if the user is in the current row. If the user leaves the particular row empty and presses the save button the error message should show in the current row, not all the rows. How do I do this?
You can find what you are looking for at GridView Examples for ASP.NET 2.0: Editing the Underlying Data in a GridView
精彩评论