I have an asp.net GridView with a DropwDownlist control and a bunch of other textboxes for text entry etc. The user can add multiple rows to the grid and change existing data etc.
I need the RequiredFieldValidator to fire only for the current row being accessed. I've set the InitialValue to the correct value and I get the validator to fire, the problem I'm having is it fires for every row instead of just the one currently being worked on.
Any ideas?
My validator under the DropDown in the GridView:
<asp:RequiredFieldValidator ID="rfRoles" runat="server" ErrorMessage="Role Required"
ControlToValidate="ddlRole" ValidationGroup=roles InitialValue="-1" Display="Dynamic" SetFocusOnError="true" Text="*">
</asp:RequiredFieldValidator>
<asp:ValidationSummary ID="validateRole" runat="server" ShowMessageBox="True" ShowSummary="false" ValidationGroup="roles" />
My save button in the grid:
<EditItemTemplate>
<asp:LinkButton ID="lnkSave" runat="server" Text="Save" CommandName="Update" CausesValidation="true" ForeColor="#AE0917" ValidationGroup="roles" Font-Bold="true"></asp:LinkButton></EditItemTemplate>