Mar 30, 2005 #1 rotsey Programmer Nov 23, 2004 135 AU Hi, How do you set the selectedIndex property of a dropdownlist if you know the "text" property. Something like this drp.selectedIndex.Indexof(mystring) i have seen it somewhere????? rotsey
Hi, How do you set the selectedIndex property of a dropdownlist if you know the "text" property. Something like this drp.selectedIndex.Indexof(mystring) i have seen it somewhere????? rotsey
Mar 30, 2005 #2 ca8msm Programmer May 9, 2002 11,327 GB You can use the DropDownList1.Items.FindByText method to return a listitem and just set the selectedIndex accordingly ---------------------------------------------------------------------- Need help finding an answer? Try the search facilty (http://www.tek-tips.com/search.cfm) or read FAQ222-2244 on how to get better results. Upvote 0 Downvote
You can use the DropDownList1.Items.FindByText method to return a listitem and just set the selectedIndex accordingly ---------------------------------------------------------------------- Need help finding an answer? Try the search facilty (http://www.tek-tips.com/search.cfm) or read FAQ222-2244 on how to get better results.
Mar 30, 2005 #3 checkai Programmer Jan 17, 2003 1,629 US Code: ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText("TEXTVALUE")) "...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..." Upvote 0 Downvote
Code: ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText("TEXTVALUE")) "...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
Mar 30, 2005 #4 shatch Programmer Jul 9, 2004 346 GB Or drp.items.findbytext("Test").selected = true Upvote 0 Downvote
Mar 30, 2005 Thread starter #5 rotsey Programmer Nov 23, 2004 135 AU thanks checkai, thats what I was after Upvote 0 Downvote
Mar 30, 2005 Thread starter #6 rotsey Programmer Nov 23, 2004 135 AU thats not bad either shatch Upvote 0 Downvote