Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 October 31st, 2005, 03:38 AM
Registered User
 
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing values from dropdownlist

How to passing value from dropdown list into text box without postback. VB or Java script need.


 
Old October 31st, 2005, 03:52 AM
Authorized User
 
Join Date: Jul 2005
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sparc,

You can onChange EventHandler to achieve this. Please see the following quick example:

<form>
  <select id="tst" onChange="getValue(this)">
     <option value="0">Dropdown Example</option>
     <option value="1">Lavanya</option>
     <option value="2">Deepak</option>
  </select><br>
  <input type="text" id="txt">
</form>
<script>
  function getValue(obj)
  {
     document.getElementById("txt").value = obj.options[obj.selectedIndex].text;
  }
</script>

Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
 
Old October 31st, 2005, 09:42 AM
Registered User
 
Join Date: Jul 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,
This is working,
but I using asp:dropdown list. Help me about this, or help me how to
fill static html dropdown list with records from database, and how to hiding and viewing it.






Similar Threads
Thread Thread Starter Forum Replies Last Post
2 field Values within DropDownList.DataValueField rit01 ASP.NET 2.0 Basics 4 May 11th, 2016 03:22 AM
Bind DropDownList with null values jwiedmier BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 January 9th, 2008 02:19 AM
Dropdownlist Values From Database tranzformerz BOOK: Beginning ASP.NET 1.0 2 September 7th, 2005 03:06 PM
passing an object to the dropdownlist jaisonkmathews General .NET 1 September 27th, 2004 11:44 AM
datagrid dropdownlist values mlwallin ASP.NET 1.0 and 1.1 Professional 0 July 8th, 2003 06:50 PM





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