Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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


 
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

 
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
 
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
 
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;






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.