HOW TO Refresh a Drop Down List Box ???


B

Brad Isaacs

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 [email protected]

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
 
Ad

Advertisements

B

bpd

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 [email protected]

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

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

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top