开发者

Required Field validator in grid view

开发者 https://www.devze.com 2022-12-21 00:45 出处:网络
I have one dynamic grid. In that amount and date are not null columns. <asp:TemplateField> <ItemTemplate>

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

0

精彩评论

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