473,378 Members | 1,541 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,378 software developers and data experts.

Selecting an item in a Dropdown list from DB after insert

Hi,

I have a 2 drop down lists in C# populated with data from a SQL 2005 db.

When a new item of data is inserted the second list must update to reflect the change (the first drop down list will always be unchanged by inserts) and the new value must become the selected value in drop down list 2. I use databind() after the form has autoposted back after the insert but the 1st and 2nd drop down lists default back to the first item in the list. I'm using detailsview throughout.


Any help would be much appreciated.

Cheers
Feb 12 '08 #1
2 1674
abev
22
Hi,

I have a 2 drop down lists in C# populated with data from a SQL 2005 db.

When a new item of data is inserted the second list must update to reflect the change (the first drop down list will always be unchanged by inserts) and the new value must become the selected value in drop down list 2. I use databind() after the form has autoposted back after the insert but the 1st and 2nd drop down lists default back to the first item in the list. I'm using detailsview throughout.


Any help would be much appreciated.

Cheers

Sunny I am confused (more my fault than yours) but let me throw something out there.

On load or however you choose initially, load the data in the first combobox. Then after the first combobox is selected, fill the 2nd (OnLeave, SelectedIndexChanged).
Feb 13 '08 #2
Hi,

Oh, sorry, the orginal data is already populated in the second drop down box and is linked perfectly to the first. I just need to a) insert a the new item into the second drop down box and b) make the new item selected in the 2nd drop down list. Is that clearer?

Cheers
Feb 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rod Early | last post by:
I need to know when the select element's dropdown list is opened (as when the user clicks on the arrow or does ALT-downarrow from the keyboard). Similarly, I need to known when the dropdown list...
3
by: Vinay | last post by:
Hi All: I'm having a strange problem with the dropdownlist. Here is what is happening: I have a webform on which I have a whole bunch of controls. The form has 2 dropdownlists. The dropdowns...
0
by: E . | last post by:
I seem to be getting nowhere with this problem here is the situation. I have a webform with a data grid populated with the results of a table that has only 3 fields. Then below that are 1...
6
by: San Smith | last post by:
I have a dropdown list box with list of item. When I read the data from database I want to display that value(one of the item in the drop down box) in the dropdown list box. How to do that in a...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
3
by: Big Dave | last post by:
I know it's been asked a million times before, but I still can't seem to find an answer that works. I've got a dropdown list in the footer template of a datagrid. The dropdown list databinds,...
1
by: Yoshitha | last post by:
Hi in my web form i had dropdown list control and using items property i;ve added "--- select Item-----" 0 1
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
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
0
by: Ed Dror | last post by:
Hi there, I'm using Wisual Studio 2005 Pro with SQL server 2005 Dev on XP SP2 I have two tables Generic Item table (GN_ID) PK Color Table (Color_ID) PK and GN_ID FK very simple one to many...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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...

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.