then.. set the requiredfieldvalidator's controltovalidate property to "DropDownlist1" and set the "InitialValue" property of the requiredfieldvalidator to "0" as this will be the value for "--Select--" you can show above..
hope it helps./.
please let us know if you are having some another doubt than this one..
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.
nareshguree2...
Star
11118 Points
1997 Posts
how to set required field validator with DropDownList
Jun 19, 2007 05:03 AM|LINK
i am facing problem with dropdownlist when i fill drop down with sqldatasouce.
christoc
Star
8562 Points
1566 Posts
Re: how to set required field validator with DropDownList
Jun 19, 2007 05:06 AM|LINK
Is your problem that you can't set the requiredfieldvalidator to a dropdown list, or are you getting an error when you bind to the list?
DotNetNuke Upgrades and Consulting
Nitinkcv
Member
710 Points
264 Posts
Re: how to set required field validator with DropDownList
Jun 19, 2007 05:14 AM|LINK
Hi,
Could you please post your code here.
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: how to set required field validator with DropDownList
Jun 19, 2007 06:08 AM|LINK
please specify more what type of problem you are facing.. is that any error or...
how to set required field validator with DropDownList
suppose you are having this items in your dropdownlist..
DropDownList1.Items.Add(new ListItem("--Select--","0"));
DropDownList1.Items.Add(new ListItem("Kaushal","1"));
DropDownList1.Items.Add(new ListItem("Naresh","2"));
DropDownList1.Items.Add(new ListItem("Pankaj", "3"));
then.. set the requiredfieldvalidator's controltovalidate property to "DropDownlist1" and set the "InitialValue" property of the requiredfieldvalidator to "0" as this will be the value for "--Select--" you can show above..
hope it helps./.
please let us know if you are having some another doubt than this one..
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.
nareshguree2...
Star
11118 Points
1997 Posts
Re: how to set required field validator with DropDownList
Jun 19, 2007 07:11 AM|LINK
DropDownList1.Items.Add(new ListItem("--Select Color--","0"));
DropDownList1.Items.Add(new ListItem("Red","1"));
DropDownList1.Items.Add(new ListItem("Blue","2"));
DropDownList1.Items.Add(new ListItem("White", "3"));
DropDownList1.Items.Add(new ListItem("Pink", "4"));
i want set on client site validator. means required field validator
solve the problem
means we set InitialValue
W3C Validation
nareshguree2...
Star
11118 Points
1997 Posts
thanx
Jun 19, 2007 07:15 AM|LINK
Thanx Kaushal
regards
naresh guree
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: thanx
Jun 19, 2007 08:07 AM|LINK
pleasure to help you.. and dont forget to mark the thread as answered so it could be helpful to others in future.,
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.
krishnapriya...
Member
6 Points
3 Posts
Re: how to set required field validator with DropDownList
Feb 15, 2010 08:01 AM|LINK
<asp:DropDownList ID="ddlstatus" runat="server" AutoPostBack="true" DataTextField='<%# Eval("Status") %>' Width="120px">
<asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Active</asp:ListItem>
<asp:ListItem>InActive</asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please select status" ControlToValidate="ddlstatus" ValidationGroup="btnAdd" InitialValue="--Select--"></asp:RequiredFieldValidator>
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.
krishnapriya...
Member
6 Points
3 Posts
Re: how to set required field validator with DropDownList
Feb 15, 2010 08:03 AM|LINK
<asp:DropDownList ID="ddlstatus" runat="server" AutoPostBack="true" DataTextField='<%# Eval("Status") %>' Width="120px"> <asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Active</asp:ListItem> <asp:ListItem>InActive</asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please select status" ControlToValidate="ddlstatus" ValidationGroup="btnAdd" InitialValue="--Select--"></asp:RequiredFieldValidator>
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.
krishnapriya...
Member
6 Points
3 Posts
Re: how to set required field validator with DropDownList
Feb 15, 2010 08:04 AM|LINK
<asp:DropDownList ID="ddlstatus" runat="server" AutoPostBack="true" DataTextField='<%# Eval("Status") %>' Width="120px"> <asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Active</asp:ListItem> <asp:ListItem>InActive</asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please select status" ControlToValidate="ddlstatus" ValidationGroup="btnAdd" InitialValue="--Select--"></asp:RequiredFieldValidator>
Suppose i have 2 list items like active,inactive. First i will set initial value for dropdownlist same is given in required field validator initial value property.Thats it . Any more doubts plz get back to me.