Skip to main content

I'm attempting to filter a dropdown list based on the value of a parent dropdown list. Everything appears to be configured correctly, but the second dropdown is returning all of the values vs. the expected filtered values.

 

Parent Stored Procedure

USE  TempLaborMasterDB]
GO
/****** Object: StoredProcedure dbo]..SP_Get_All_Location_Types] Script
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE dbo]..SP_Get_Location_Types]
-- Add the parameters for the stored procedure here

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT LocationTypeID, LocationType
FROM dbo.LocationTypes

END

Child Stored Procedure

USE  TempLaborMasterDB]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE dbo]..SP_Get_Locations_Name]
-- Add the parameters for the stored procedure here

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT
LocationName,LocationTypeID
FROM dbo.Locations

END

Table Scheme

16989i66C8E07179C0F57D.png

 

Parent Dropdown List Control

14703i2F6B24AB08F60C3F.png

 

Dear , 

 

I know that u r using  a correct approach , but there is another approach i want u to try , 

On page initialize , keep the "populate list control with data" for first drop down list (Location Types)

Disable/remove second drop down list population , 

 

14356i858F5B8A470ABAA1.png

 

In ur case , u need to filter using 1stDDL ID = 2ndDDL TypeID

 

the scenario will go like this , when ever the 1stDDL is changed , it will check its value , if it doesnt equal to empty , it will take this value and use it to populate the 2ndDDL and filter the data according to the 1stDDL ID .

 

Hope this helps! 

Regards.

 

 


Hi jwstl98

 

It looks to me as if you have the incorrect join property on the second drop down. You have the parent join property as LocationType, and the child join property as LocationTypeID.  From your stored procedures it looks like the parent join property should be LocationTypeID.


could you describe the idea setup for the database tables. I'm wanting to make sure I do this properly from the start.


Reply