Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,


Requiredfieldvalidator is not working for dropdownlist which is present in footer tamplate of gridview control in asp.net

my code is as follows:

XML
<FooterTemplate>
                            <asp:DropDownList ID="ddlcustomer" runat="server" AppendDataBoundItems="true" DataSource='<%#GetCustomer() %>'
                                DataTextField="CustomerName" DataValueField="CusVenID" ValidationGroup ="FtrowValidation">
                                <asp:ListItem Value="-1">-Select-</asp:ListItem>
                            </asp:DropDownList>
                           <asp:RequiredFieldValidator ID="reqfvCustomerName" runat="server" InitialValue="0" ControlToValidate="ddlcustomer"
                                 ValidationGroup="FtrowValidation" ErrorMessage="select Customer"
                                Display="Dynamic" Text ="*"></asp:RequiredFieldValidator>

                        </FooterTemplate>


please advise me.
Posted

1 solution

Sir;
I guess the property InitialValue should set to -1, because the value of the default item '-Select-' is -1 not 0.
 
Share this answer
 
Comments
udaysimha 21-Sep-11 9:25am    
it working fine

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900