Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 20, 2013 09:46 PM by carinos.carlos
Member
4 Points
9 Posts
Jan 18, 2013 03:33 PM|LINK
Hi
I have a web form with two comboboxes, both have the same data (Origin, Destiny)
Is there any way to validate the selected item are different ?
Tks in advance
Cariños Carlos
Participant
882 Points
223 Posts
Jan 19, 2013 05:37 AM|LINK
Hii,
Something like that
<asp:DropDownList id="dd1" runat="server" > <asp:ListItem Value="1" Text="Ahmedabad" > </asp:ListItem> <asp:ListItem Value="2" Text="Rajkot" > </asp:ListItem> <asp:ListItem Value="3" Text="Baroda" > </asp:ListItem> </asp:DropDownList> <asp:DropDownList id="dd2" runat="server" > <asp:ListItem Value="1" Text="Ahmedabad" > </asp:ListItem> <asp:ListItem Value="2" Text="Rajkot" > </asp:ListItem> <asp:ListItem Value="3" Text="Baroda" > </asp:ListItem> </asp:DropDownList> <asp:CompareValidator ID="cmp1" runat="server" ControlToCompare="dd2" ControlToValidate="dd1" Operator="NotEqual" ErrorMessage="Origin and destination is not same" Display="Dynamic" ></asp:CompareValidator>
97 Points
60 Posts
Jan 19, 2013 08:45 AM|LINK
if(dropdown2.selecteditem.text!=dropdown1.selecteditem.text)
{
Response.Write("Both Data are not same ")
}
Else
Your Coad...............
Jan 20, 2013 09:46 PM|LINK
Perfect Nikunj !!
Tks a lot
C@riños C@rlos
carinos.carl...
Member
4 Points
9 Posts
RequiredFieldValidator to compare two asp combobox
Jan 18, 2013 03:33 PM|LINK
Hi
I have a web form with two comboboxes, both have the same data (Origin, Destiny)
Is there any way to validate the selected item are different ?
Tks in advance
Cariños Carlos
nikunjnandan...
Participant
882 Points
223 Posts
Re: RequiredFieldValidator to compare two asp combobox
Jan 19, 2013 05:37 AM|LINK
Hii,
Something like that
<asp:DropDownList id="dd1" runat="server" > <asp:ListItem Value="1" Text="Ahmedabad" > </asp:ListItem> <asp:ListItem Value="2" Text="Rajkot" > </asp:ListItem> <asp:ListItem Value="3" Text="Baroda" > </asp:ListItem> </asp:DropDownList> <asp:DropDownList id="dd2" runat="server" > <asp:ListItem Value="1" Text="Ahmedabad" > </asp:ListItem> <asp:ListItem Value="2" Text="Rajkot" > </asp:ListItem> <asp:ListItem Value="3" Text="Baroda" > </asp:ListItem> </asp:DropDownList> <asp:CompareValidator ID="cmp1" runat="server" ControlToCompare="dd2" ControlToValidate="dd1" Operator="NotEqual" ErrorMessage="Origin and destination is not same" Display="Dynamic" ></asp:CompareValidator>Nikunj Nandaniya
My Blog
Dheerendra
Member
97 Points
60 Posts
Re: RequiredFieldValidator to compare two asp combobox
Jan 19, 2013 08:45 AM|LINK
if(dropdown2.selecteditem.text!=dropdown1.selecteditem.text)
{
Response.Write("Both Data are not same ")
}
Else
{
Your Coad...............
}
carinos.carl...
Member
4 Points
9 Posts
Re: RequiredFieldValidator to compare two asp combobox
Jan 20, 2013 09:46 PM|LINK
Perfect Nikunj !!
Tks a lot
C@riños C@rlos