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

HOW TO Refresh a Drop Down List Box ???

ASP.NET 2.0 / SQL Server 2000 db / Visual Basic Code behind

On my .aspx page I have added an SQL Datasource that contains the SQL query
to retrieve the list for my Drop Down List Box.

Using this SQLDataSource I can retrieve my drop down list data.

SELECT DISTINCT responsibleMinister
FROM responsibleMinister
WHERE languageID = @languageID
ORDER BY responsibleMinister ASC
I have a button that I have added that calls a stored Proc to INSERT DATA
into that same table

BEGIN
-- Find the next PK value for responsibleMinisterID
DECLARE @responsibleMinisterID smallint
SELECT @responsibleMinisterID=MAX(responsibleMinisterID)+ 1
FROM dbo.[responsibleMinister]
WHERE languageID=@languageID

INSERT INTO dbo.[responsibleMinister](
[responsibleMinisterID],
[languageID],
[responsibleMinister])
VALUES (
@responsibleMinisterID,
@languageID,
@responsibleMinister)
END

The Insert Stored Procedure works well, however, I now need to UPDATE my
Drop Down List box with the data that lies within the responsible Minister
table.

I tried to enable Post Back but that did not refresh the drop down list.

Can someone please help me resolve this issue of "How I may REFRESH the list
found within the drop down list box with the new values found within the
database table"???

Any ideas would be greatly appreciated,

Thanks,

~Brad
------------------------------
Brad Isaacs
Mar 28 '07 #1
3 14971
bpd
On Mar 28, 12:44 pm, "Brad Isaacs" <bisa...@rogers.comwrote:
ASP.NET 2.0 / SQL Server 2000 db / Visual Basic Code behind

On my .aspx page I have added an SQL Datasource that contains the SQL query
to retrieve the list for my Drop Down List Box.

Using this SQLDataSource I can retrieve my drop down list data.

SELECT DISTINCT responsibleMinister
FROM responsibleMinister
WHERE languageID = @languageID
ORDER BY responsibleMinister ASC

I have a button that I have added that calls a stored Proc to INSERT DATA
into that same table

BEGIN
-- Find the next PK value for responsibleMinisterID
DECLARE @responsibleMinisterID smallint
SELECT @responsibleMinisterID=MAX(responsibleMinisterID)+ 1
FROM dbo.[responsibleMinister]
WHERE languageID=@languageID

INSERT INTO dbo.[responsibleMinister](
[responsibleMinisterID],
[languageID],
[responsibleMinister])
VALUES (
@responsibleMinisterID,
@languageID,
@responsibleMinister)
END

The Insert Stored Procedure works well, however, I now need to UPDATE my
Drop Down List box with the data that lies within the responsible Minister
table.

I tried to enable Post Back but that did not refresh the drop down list.

Can someone please help me resolve this issue of "How I may REFRESH the list
found within the drop down list box with the new values found within the
database table"???

Any ideas would be greatly appreciated,

Thanks,

~Brad
------------------------------
Brad Isaacs
I'm assuming you're binding the datasource to the dropdownlist control
somehow.
After the insert/update, you'll need to re-bind.

Mar 28 '07 #2
Call the DataBind() function of the drop down list.

Mar 29 '07 #3
bpd & Latish,

Thank you very much for your input

~Brad
:)))
"Latish Sehgal" <la***********@gmail.comwrote in message
news:11*********************@n76g2000hsh.googlegro ups.com...
Call the DataBind() function of the drop down list.

Mar 29 '07 #4

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

Similar topics

1
by: Tom Ewall | last post by:
I have an iframe which has a drop-down list, which I'm trying to use to refresh a drop-down list in the main page. I'm using this call to refresh the page: ...
3
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
5
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
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: 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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.