473,465 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dropdown database bound - simple screen with only dropdownbox, bestway to solve it [newby]

Hello,

Since im quite new to ASP.NET i wanted to ask you folks what the best
way is to create a WebForm for modifying 1 field from a record. The
manipulation of this field can be done by using dropdown list.

Previously i've written a lot of these page's by not using the
webcontrols, but now i've reached this magically moment that i want to
try these features. :D

In short, the program exists of 1 table, called "details" and another,
which is called "lookup". The aspx page is started with the parameter
key. So the call will be the following:

http://localhost/aspcontrols/DetailsEdit.aspx?key=1234

My current code:
================
- Added OleDbConnection to the webform
- Connection String is retrieved from web.config (done by adjusting
dynamic properies)

- Added a DataAdapter (for the details table)
- Modified the SelectCommand in such a way that it needs an
CommandParameter.

- Added a DataAdapter (for the lookup table) (only select command)

- Generated a DataSet for both table's in DataDefinitions DataSet

- Added the DataDefinitions DataSet to the webform

- Added a dropdown to the webform
Properties:
- DataMember = lookup
- DataSource = dataSet
- DataTextField = lookupfield
Databindings:
-SelectedValue = Simple Binding: dataSet -> Details -> [..] -> field

- Added a button to the form with the following code:
detailsDataAdapter.Update(dataSet);

- Added a method PageLoad with the following code:
private void Page_Load(object sender, System.EventArgs e)
{
if(Request.Params["key"] == null)
{
throw new HttpException("Parameter 'key' is missing");
}
if (!this.IsPostBack )
{ oleDbSelectCommand.Parameters["key"].Value
= Request.Params["key"];
detailsDataAdapter.Fill(dataSet);
if(dataSet.Tables["details"].Rows.Count != 1) throw new
HttpException("Did not find 1 record for key:" + Request.Params["key"]);
lookupDataAdapter.Fill(dataSet);
dropdown.DataBind();
}
}
Problems:
================
- Value of the current value is not set in the dropdown list
- When i press the button, i dont have the any data in the dataset.

Question:
================
- What should i change in the current situation to make it work
- What is the -best- way to create such a page (sample's / pointers)
- Is it wise to use the databinding? Lots of examples use an iteration
to put the data in the dropdown box
- How do i close the window after is saved the data?

Eduard Witteveen
Nov 18 '05 #1
0 1285

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

Similar topics

10
by: J P Singh | last post by:
Hi There We have dropdown on ASP page. The problem is we have about 900 items in the dropdown. Users scrolling through the list have become very frustrated in the past. Can someone suggest...
1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
20
by: Dannyboyo | last post by:
I have what I hope is a simple request. I can't really code in javascript, but I am pretty good at cusomizing it with slight modifications. I code in ASP and HTML. I am trying to capture customer...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
2
by: John Thomas Smith | last post by:
I have an Access 97 database I would like to distribute, and provide a compiled program for those who don't have Access I do have the Access 97 developer tools CD and runtime, but the install...
9
by: C Newby | last post by:
I have a data grid control taht contains a data bound coulmn called "Type". Depending on the value of "Type" I want to display a corresponding image in the rendered table cell. So, if the value of...
2
by: Sam | last post by:
A) Destination Table with 4 Fields. 1) Last Name 2) First Name 3) State 4) Zip Code. B) Look up table State/Zip Code with 2 Fields
13
by: Shutey | last post by:
I have a strange issue with dropdowns. Using php4, mySQL5, Apache 2 on a fast XP pro PC, I have a form which requires 5 dropdowns populated with indentical values. I extract the values using SQL...
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.