.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 11th, 2003, 02:02 PM
evelin evelin is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 6 evelin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Getting the Selection From the DropDownList

I'm trying to get the value of the selection from the databound dropdownlist to be displayed in a textbox. <br>I have set the Autopostback property to true <br><br>However, the value that is displayed is always the first value from the database or rather the selected value is always the first value of the dropdownlist. <br><br>Here is the VB code:<br><br>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load <br>OleDbDataAdapter1.Fill(DataSet11) <br>DropDownList1.DataBind() <br><br>End Sub <br><br>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click <br><br>End Sub <br><br>Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged <br>Dim str As String <br><br>str = DropDownList1.SelectedItem.Text <br><br>TextBox4.Text = str <br><br>End Sub <br>End Class <br><br>Please Help. Any assistance will be very much appreciated

Reply With Quote
  #2  
Old April 14th, 2003, 07:51 AM
bkalicharan bkalicharan is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 51 bkalicharan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 42 m 59 sec
Reputation Power: 6
Hello evelin,<br><br>U r doing the basic mistake on page load u r filling the values in the Drop Down List box.<br>Whenever DDL selected Index changes the form submits then again it goes to form load method and refills the values in it.<br>So u have to write this filling data when only the form is not post backed<br>If Not Page.IspostBack then<br> DDL.databind()<br>.................<br>end if<br><br>kalicharan

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Getting the Selection From the DropDownList


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT