473,569 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ 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
CommandParamete r.

- 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:
detailsDataAdap ter.Update(data Set);

- Added a method PageLoad with the following code:
private void Page_Load(objec t sender, System.EventArg s e)
{
if(Request.Para ms["key"] == null)
{
throw new HttpException(" Parameter 'key' is missing");
}
if (!this.IsPostBa ck )
{ oleDbSelectComm and.Parameters["key"].Value
= Request.Params["key"];
detailsDataAdap ter.Fill(dataSe t);
if(dataSet.Tabl es["details"].Rows.Count != 1) throw new
HttpException(" Did not find 1 record for key:" + Request.Params["key"]);
lookupDataAdapt er.Fill(dataSet );
dropdown.DataBi nd();
}
}
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 1292

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

Similar topics

10
5241
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 if there is another way of implement a dropdown where the datalist is as big as ours. I am looking for something like a listbox in VB where you can...
1
8266
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 dropdown lists. If you change the selection of the left one (e.g. choose parentoption2), it should open up page2.htm in a popup window.
20
12370
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 input of product names to put on custom labels we make. Some of the labels will have our product names on them, but the customer can add other...
14
10115
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 I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ...
2
1385
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 that creates is REALLY large (essentially, from what I know, the entire Access 97 application with all the development interface removed or "locked...
9
1979
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 type is 1, I want to show image1.gif. If the value is 2, I want to show image2.gif. Is there an easy way to do this? TIA//
2
9720
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
2176
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 and populate 2 variables and use a for-next loop to create the dropdown. The dropdown contains some 310 items! It works beautifully if I have 1 or 2...
4
4566
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 reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.