p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   How to set selected item in Dropdownlist? (http://p2p.wrox.com/showthread.php?t=51820)

MTLedari December 21st, 2006 03:34 AM

How to set selected item in Dropdownlist?
 
I can't set the selected item of the dropdownlist
All the dropdownlists are selected at the 1st one item

I know we can set selected item of our Dropdownlist conrol with "SelectedIndex" property, but i don't know how i can obtain my favorite item's index (or favorite value's index)?

How to set it? Somebody can help me



jamil umar December 23rd, 2006 09:09 AM

Yes i have wanting to ask a similar question about setting dropdowns selectedvalue for each individual dropdownlist on pageload ie
if you have n Numbers of DropDownList Controls on the page How do you set there selected sequencialy in this other :
DropDown1.selectedvalue=0
DropDown2.selectedvalue=1
DropDown3.selectedvalue=3
DropDown4.selectedvalue=n
Thanx


DuhMaster December 25th, 2006 05:40 AM

if you have value of item you can try to use
dropdownlist1.text= <value need to select>

Sorry for my English :-)

punk`s not dead

sh.rajkumar December 26th, 2006 03:02 AM

You can set with Dropdownlist's selectedvalue property.


-------------------
rajkumar sharma
http://www.apnasaathi.blogspot.com

Sunnys December 27th, 2006 12:53 AM

if u know which value to select use this
dropDownList1.ClearSelection();
DropDownList.Items.FindByText("Value").Selected=tr ue;




All times are GMT -4. The time now is 01:24 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.