Home All Groups Group Topic Archive Search About

how to synchronize multiple drop down lists?

Author
7 Sep 2006 7:17 PM
Ed Dror
Hi there
ASP.NET 2.0 VB & SQL Express

Lest take Northwind  Categories Products as example

I create a table that hold these two together
and I create a stored procedure like
select ProductID, ProductName, CategoryID, from tblCategoryProducts
Where (CategoryID = @CategoryID)

and (in asp.net page) the where control I set to cboCategory.CategoryID

every thing works fine for the first time when you choose category it will
populate correctly the cboProducts
But it stuck on the first attempt when you chosse another category it won't
change the cboProducts

My question is how synchronize the Products CBO base on Caregory cbo on real
time changes
P.S it works fine with MS Access northwind database

Thanks,
Ed Dror
Andrew Lauren

Author
8 Sep 2006 1:21 AM
Walter Wang [MSFT]
Hi Andrew,

After reading throught your post, I'm not quite clear on some points. Would
you please help me on these points:
1) Are you using ASP.NET Data Source controls such as ObjectDataSource or
SqlDataSource?
2) Would you please post some code such as how you associate the two
DropDownList? A complete working project is better, though.

If you are using Data Source controls, they can bind some parameter to a
control's property; thus when the control's property is changed on
postback, the Data Source control will automatically get updated data. Then
you bind your second DropDownList to the Data Source control.

I'm looking forward to your update so that we can continue further
discussion. Thank you.

Sincerely,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Author
8 Sep 2006 4:57 PM
Ed Dror
Walter,

I'm using sqlDataSource

Base on MS Dynamics SL I extracted the Modules (75) and Screens (1300)
Then I create one (Module) to Many (Screens) relationship
Then I create a table ModulesScreens looks like this

ModuleID, ModuleCode, ModuleName, ScreenID, ScreenName, ScreenNumber,
ScreenType

Now in WebDev Express asp.net I created one Drop Down list base on
sqlDatasource Modules tabls
Object Name = ModuleName + enable auto post back

Then I created Drop Down list base on Stored Procedure look like this
Object Name = ScreenNumber
set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

ALTER PROCEDURE [dbo].[usp_SelectScreen]

@ModuleName varchar(50)

AS

SELECT ModuleName, ScreenName, ScreenNumber, ScreenType, ScreenID

FROM ScreensModules WHERE (ModuleName = @ModuleName)

ORDER BY ScreenName

With the WHERE = Control
ControlID = ModuleName (this is the Modules drop down list)
Value = ModuleName.SelectedValue

When you run this page it working for the first open drop down list

I'm picking General Ledger from Modules drop down and the second module show
all the screens
That belong to this module but when I pick another module name the second
drop down did not refresh
It stuck with the first pick from the drop down
Its very very similar to MS KB #289670 with Access database

I hope you will get the picture now and tell me how can I refresh the second
drop down list?

I also created a function that will call the stored procedure with passing
parameter from the Module drop down list
And (function call mySelectScreen)
Protected Sub ScreenName_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles ScreenName.SelectedIndexChanged

Call mySelectScreen()

End Sub

but with no succsess

Thanks,

Ed



Show quote
"Walter Wang [MSFT]" <waw***@online.microsoft.com> wrote in message
news:ieEUlUu0GHA.400@TK2MSFTNGXA01.phx.gbl...
> Hi Andrew,
>
> After reading throught your post, I'm not quite clear on some points.
> Would
> you please help me on these points:
> 1) Are you using ASP.NET Data Source controls such as ObjectDataSource or
> SqlDataSource?
> 2) Would you please post some code such as how you associate the two
> DropDownList? A complete working project is better, though.
>
> If you are using Data Source controls, they can bind some parameter to a
> control's property; thus when the control's property is changed on
> postback, the Data Source control will automatically get updated data.
> Then
> you bind your second DropDownList to the Data Source control.
>
> I'm looking forward to your update so that we can continue further
> discussion. Thank you.
>
> Sincerely,
> Walter Wang (waw***@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>

AddThis Social Bookmark Button