Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
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 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 August 13th, 2007, 12:59 AM
Authorized User
Join Date: Sep 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in Displaying preselected data in dropdown


       I am having problem in displaying preselected value from database in dropdownlist. I have 2 tables User(ID,Name)and Country(ID,Name).Am inserting Countryname from a Countrydropdwnlist for an UserId. Now i need to display the particular Country of the user get selected in the dropdwnlist.(i.e the dropdwnlist will contain all the Countryname and the particular counrty of that user should be selected by default).Am only getting the 0 index Countryname selected by default.How can i do This??

Old August 13th, 2007, 06:01 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Can we see the RELEVANT code for this?

** Please do not post the entire page, just what is relevant. **

Old August 14th, 2007, 05:00 AM
Authorized User
Join Date: Sep 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts

Hey all,

   got the solution. just use the following method --
DropDownListSex.SelectedIndex = DropDownListSex.Items.IndexOf(DropDownListSex.Item s.FindByValue(selectreader.GetChar(3))

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Displaying Data Using Repeater Control cyberstore05 ASP.NET 2.0 Professional 0 January 5th, 2008 01:45 PM
display data in the dropdown vivek_inos Access VBA 1 November 25th, 2005 07:02 PM
Displaying Records From SELECT dropdown mgordon Classic ASP Databases 12 August 3rd, 2005 12:27 PM
Displaying values in dropdown list from mysql db scoobie Beginning PHP 3 January 25th, 2005 12:09 PM
How to bind data to a dropdown in a datalist thats broushly ASP.NET 1.0 and 1.1 Basics 1 April 28th, 2004 01:52 PM

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