473,383 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Default dropdown list to database value

Hi,

I have an aspx page with a drop down.

This is a page where a user can edit their user profile.

When they go to this page, I want the dropdownlists to
default to what it is in teh user table.

I have tried calling a function that renders out the
html, but my html looks like <asp:listitem> so it is not
interpreting the server side code.

Anyone know how to do this i.e. set the selected value to
that in the database and render out additional items in
the list?

Thanks,
Kerri.
Jul 19 '05 #1
1 4126
Hi Kerri,

If I read your post correctly, you have a hard-coded list of items in the
dropdown list. As long as you have a runat="Server" on the asp:dropdownlist,
and it has an ID, you can code against it in the Form_Load event. I'd say
you have to then iterate through the items in the list, comparing every item
to the database value, and setting the Selected property on the correct
item.

Hope this helps

Thys Brits
MCSD/MCAD
"Kerri" <ke***@nospam.com> wrote in message
news:04****************************@phx.gbl...
Hi,

I have an aspx page with a drop down.

This is a page where a user can edit their user profile.

When they go to this page, I want the dropdownlists to
default to what it is in teh user table.

I have tried calling a function that renders out the
html, but my html looks like <asp:listitem> so it is not
interpreting the server side code.

Anyone know how to do this i.e. set the selected value to
that in the database and render out additional items in
the list?

Thanks,
Kerri.

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking...
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
1
by: Kerri | last post by:
Hi, I have an aspx page with a drop down. This is a page where a user can edit their user profile. When they go to this page, I want the dropdownlists to default to what it is in teh user...
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
11
by: eureka | last post by:
Hi All, I'm training in Servlets, JSP and JavaScript, I have a web page in which there's a "StudentName" textbox and below it is a "Names" Dropdown list. Initially the Textbox is empty and...
2
by: rn5a | last post by:
During registration, users have to provide their date of birth. For the date & month part, there are 2 dropdown lists & for the year, there's a textbox. These 3 fields are finally merged together...
4
by: Paul | last post by:
Hi all, I have a page that has a form on it which has a dropdown list on it. It connect to an sql database and populate the list. What I would like to do is make the list editable so that if the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.