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 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 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 Professional 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 19th, 2006, 12:52 PM
Authorized User
 
Join Date: Nov 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yasminnnnn
Default preselecting dropdownlist item

hey
i have a detailsview and a seperate dropdownlist in my page. i get a variable MTDescription via querystring from another page. i try to find that text value in the dropdownlist items and i want it to be returned as selected item.dropdownlist gets its values from a sql datasource..
this is what i tried:
            Label11.Text = Request.QueryString["MTDescription"];
            DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.Fi ndByText(Label11.Text));


when i write it to button_click event, it works fine however i want it to happen when the page loads or something else than clicking a button..i tried many events but they dont work:(

what can i do?
many thanks..

  #2 (permalink)  
Old December 26th, 2006, 06:52 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

hi,
u can directly write this code on pageload use this
DropDownList1.Items.FindByText(Label11.Text).selec ted=true;
it will help

 


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
Selecting DropDownList Item yes_no ASP.NET 1.0 and 1.1 Professional 1 April 8th, 2008 08:00 AM
adding dropdownlist item to a textbox alto ASP.NET 2.0 Basics 2 May 24th, 2007 01:14 AM
How to set selected item in Dropdownlist? MTLedari ASP.NET 2.0 Basics 4 December 27th, 2006 12:53 AM
Want Combo Box first item if only 1 item markw707 Access 3 June 9th, 2004 04:03 PM
Find Out First Item of each item Group Jane SQL Language 1 November 22nd, 2003 12:42 PM



All times are GMT -4. The time now is 11:56 PM.


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