Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 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 January 20th, 2005, 01:34 PM
Registered User
 
Join Date: Jan 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie Needs a little help Drop Down List

I have a drop down list on a web form populated by a field in the table called ID
Then I have two other fields in the same access table called Name and Occupation

What I want to to happen is that when I select a ID in the drop down box of the web form I would like the information of the other two fields to be populated into the web form using the textboxes (txtName, txtOccupation)
 
Old January 20th, 2005, 01:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Well, provided autopostback="true" on the dropdown, then in the selectedindexchanged event, put code in there that retrieves the name and occupation from the database, then assign those values to the textbox.

sub ddl_selectedindexchange(..)
  'ADO.NET code to get data from database based on ID
  'with Stored Proc or sql query method
  'Get to datatable level (or can change to be a dataset)

  if (myTable.Rows.Count > 0) then
    Dim objRow As DataRow = myTable.Rows(0)
    'If you have a datarow, do this to assign to textbox:
    txtName.Text = objRow("Name").ToString()
    txtOccupation.Text = objRow("Occupation").ToString()
end sub

HTH,

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
drop down list ashu_gupta75 Excel VBA 1 October 15th, 2007 05:52 PM
Drop down list carumuga Classic ASP Basics 1 February 6th, 2007 02:37 PM
drop down list values based on another drop down noor ASP.NET 1.0 and 1.1 Basics 3 July 5th, 2005 09:57 AM
Drop Down List mrideout BOOK: Beginning ASP.NET 1.0 6 March 18th, 2005 03:32 AM
Drop Down List Beginner123 VB How-To 2 March 7th, 2005 01:56 PM





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