requiered field validator is not working !

Posted by .Netlearner under ASP.NET on 4/24/2013 | Points: 10 | Views : 1645 | Status : [Member] | Replies : 4
Hello All,

Urgent please guide me and my code is

<asp:DropDownList ID="cmb1" runat="server" Width="100px" ></asp:DropDownList><asp:RequiredFieldValidator ID="req5" runat="server" ControlToValidate="cmb1" ErrorMessage="" InitialValue="" ></asp:RequiredFieldValidator>


but its not firing and i hav added Causesvalidation=true fro button in which i want to do my required validator function




Responses

Posted by: Krishnamanohar on: 4/24/2013 [Member] Starter | Points: 25

Up
0
Down
try this
<asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" ErrorMessage="*" Text="*" InitialValue="none" ControlToValidate="GendreDDL" ValidationGroup="ValidationButton"></asp:RequiredFieldValidator>



.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Krishnamanohar on: 4/24/2013 [Member] Starter | Points: 25

Up
0
Down
<asp:DropDownList ID="GendreDDL" runat="server" Width="151px">

<asp:ListItem Text="Choses..." Selected="True" Value="none"></asp:ListItem>

<asp:ListItem Text="Female" Value="1"></asp:ListItem>

<asp:ListItem Text="Male" Value="2"></asp:ListItem>

</asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" ErrorMessage="*" Text="*" InitialValue="none" ControlToValidate="GendreDDL" ValidationGroup="ValidationButton"></asp:RequiredFieldValidator>



.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 4/24/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Please elaborate it more

If this post helps you mark it as answer
Thanks

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 4/24/2013 [Member] Starter | Points: 25

Up
0
Down
hi
try this i hope it will help full to you

<asp:DropDownList AutoPostBack="true" ValidationGroup="g1" ID="ddlReportType" runat="server" OnSelectedIndexChanged="ddlReportType_SelectedIndexChanged"></asp:DropDownList>

<asp:RequiredFieldValidator ControlToValidate="ddlReportType" ID="RequiredFieldValidator1"
ValidationGroup="g1" ErrorMessage="Please select a type"
InitialValue="0" runat="server" Display="Dynamic">
</asp:RequiredFieldValidator>
Thanks& Regards


Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response