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
| FAQ | Members List | 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 October 24th, 2006, 12:53 AM
Authorized User
 
Join Date: Sep 2006
Location: mumbai, maharashtra, India.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default DropDownList-SelectedIndexChange(Plz Help)

i hav' a drpdwnlst and a textbox on my page. there is a table in sql server 2000 tat contains 2 columns, they are an ID column and a NAME column(the ID column is the Primary Key). the drpdwnlst displays the data from the NAME column using SqlDataSource1. the querystring in sqldatasource1 is the select query for the NAME column.
Now wat i want is, when a particular NAME is selected from the drpdwnlst then the ID for tat particular NAME should be dislayed in the textbox control. Can anyone plz share ur knowledge if u know how to achieve this ???

THANX in ADVANCE



__________________
--------------------------------------------------
therez nothin\' as impossible, bcaz the word itself says : \'i\'-\'m\'-\'possible\'
  #2 (permalink)  
Old October 26th, 2006, 11:09 AM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

in the SelectedIndexChanged event of your dropdownlist, set the text of your textbox to dropdownlist.SelectedValue

  #3 (permalink)  
Old October 27th, 2006, 01:34 AM
Authorized User
 
Join Date: Nov 2005
Location: mumbai, maharashtra, India.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In select Query from datasource select ID and Name..from TABLENAME
Set Dropdown Value Field as ID and Text Field as Name..
so when Name is selected
Then set textbox value to dropdown selected.value...

HTH,
Vivek
  #4 (permalink)  
Old October 27th, 2006, 08:13 AM
Authorized User
 
Join Date: Sep 2006
Location: mumbai, maharashtra, India.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 well, i've got it!!!
select both NAME and ID columns in SqlDataSource1,
then set the DataTextField property to the NAME column,
and DataValueField property to ID column.
After that in SelectedIndexChanged Event set the textbox1.text=dropdownlist1.selectedvalue.
also u have to enable the postback of dropdownlist to TRUE

Thanx a lot guyz
 


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
plz.....plz solve out my problem.... kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 October 4th, 2007 12:56 PM
DropDownList-SelectedIndexChange(Plz Help) dagad ASP.NET 2.0 Basics 8 November 6th, 2006 01:40 AM
Plz help me ritesh_ch23 Pro JSP 1 July 18th, 2006 10:46 PM
plz help me kale_tushar C++ Programming 1 February 26th, 2004 01:01 PM
SelectedIndexChange uses ListItem value Randy76 VS.NET 2002/2003 3 September 11th, 2003 09:33 AM



All times are GMT -4. The time now is 08:27 AM.


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