Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 21st, 2006, 03:34 AM
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


Reply With Quote
  #2 (permalink)  
Old December 23rd, 2006, 09:09 AM
Registered User
 
Join Date: May 2005
Location: kano, kano, Nigeria.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #3 (permalink)  
Old December 25th, 2006, 05:40 AM
Registered User
 
Join Date: Dec 2006
Location: Tomsk, , Russia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to DuhMaster
Default

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
Reply With Quote
  #4 (permalink)  
Old December 26th, 2006, 03:02 AM
Authorized User
 
Join Date: May 2006
Location: New Delhi, Delhi, India.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can set with Dropdownlist's selectedvalue property.


-------------------
rajkumar sharma
http://www.apnasaathi.blogspot.com
Reply With Quote
  #5 (permalink)  
Old December 27th, 2006, 12:53 AM
Authorized User
 
Join Date: Dec 2006
Location: , , India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Sunnys Send a message via Yahoo to Sunnys
Default

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


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5 GridView Selected Item stoverje BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 2 August 8th, 2008 03:11 PM
Set selected value in GridView dropdownlist SV ASP.NET 2.0 Basics 1 October 24th, 2007 01:18 PM
How to get selected item from listview? try.test.abc C# 1 January 4th, 2007 02:34 AM
How Refer to Selected Item in DataGrid Morfoman General .NET 0 September 20th, 2005 11:41 AM
How to get selected Item from Listbox? Iceman571 ADO.NET 1 March 25th, 2004 06:33 AM



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


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