Please click 'Mark as Answer' if reply assisted you.
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams
"Bob").Text; // this gets the text of the Bob value
DropDownList2.Items.FindByText(
"Bob").Value; // this gets the value of the Bob text.
Please click 'Mark as Answer' if reply assisted you.
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams
Please click 'Mark as Answer' if reply assisted you.
"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams
cplusplus1
Member
138 Points
414 Posts
How to find the dropdownlist box index value by text
Apr 10, 2007 06:10 PM|LINK
Can you please tell me how can i find the value, i have a dropdown box (ddlSelectModule) and i want to get the value by passing the text "CO"
ddlSelectModule.Items.FindByText("CO")
Thank you very much from the information.
pixelsyndica...
Star
7826 Points
1344 Posts
Re: How to find the dropdownlist box index value by text
Apr 10, 2007 06:36 PM|LINK
or
DropDownList2.Items.FindByText(
"Bob")"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams
pixelsyndica...
Star
7826 Points
1344 Posts
Re: How to find the dropdownlist box index value by text
Apr 10, 2007 06:38 PM|LINK
sorry. I get what you are trying to say..
DropDownList2.Items.FindByValue(
"Bob").Text; // this gets the text of the Bob valueDropDownList2.Items.FindByText(
"Bob").Value; // this gets the value of the Bob text."A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams
Iceman--
Member
168 Points
35 Posts
Re: How to find the dropdownlist box index value by text
Apr 10, 2007 06:40 PM|LINK
ddlSelectModule.Items.FindByText("CO").Value
Open Source SharePoint WebParts: http://www.codeplex.com/webparts
Black Belt SharePoint: http://blog.brinkhill.com
pixelsyndica...
Star
7826 Points
1344 Posts
Re: How to find the dropdownlist box index value by text
Apr 10, 2007 06:42 PM|LINK
wow.. i am dense!
here is how to get the index of the entry
int
IndexIs = DropDownList2.Items.IndexOf(((ListItem)DropDownList2.Items.FindByText("Bob")));"A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools." ~ Douglas Adams