Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 February 8th, 2011, 07:21 AM
Authorized User
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Selected value in dropdownlist based on sql result

I have a dropdownlist populated with data from database (use sqldatasource). When opening the page, the first item in chosen. How can i chose a specific value to be displayed when opening the page? I tried to define it in "on page_load", but without success.
Old February 8th, 2011, 10:03 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

Take a look here: Accessing checkboxlist from code-behind as it discusses the same topic.


Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
avidan (February 13th, 2011)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdownlist selected value avidan ASP.NET 4 General Discussion 1 December 25th, 2010 02:56 PM
find the selected index of the dropdownlist suneet.pant ASP.NET 2.0 Basics 0 May 22nd, 2008 03:45 AM
read the selected value of DropDownList from VBScr dbayona ASP.NET 2.0 Professional 0 November 11th, 2007 06:16 PM
DropDownList Selected Index = -1?? dorothee ASP.NET 1.0 and 1.1 Basics 4 June 11th, 2004 03:08 AM
selected value from dropdownlist control netwizard_01 ASP.NET 1.0 and 1.1 Basics 3 January 20th, 2004 09:29 AM

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