2013-04-02 2 views
0

aspx 페이지에 두 개의 드롭 다운 상자가 있습니다. 하나는 위치에 대한 것이고 하나는 공급 업체 목록 용입니다. 나는이에서 공급 업체 드롭 다운 메뉴에있는 모든 레코드 목록 잡을 수 있어요이aspx의 다른 드롭 다운 목록의 값에 따라 하나의 드롭 다운 목록에서 값을 변경하는 방법

SELECT Location_ID LocationID, Location_Name LocationDesc, BusinessID 
FROM inventory.tbl_location 
union 
SELECT '' LocationID,'select a location' LocationDesc,0 BusinessID 
ORDER BY BusinessID,Location_Name 

에서 위치 드롭 다운 목록에서 값을 가져 오는 오전 :

SELECT p.PayeeID, isnull(Name1_Last,'') + ', ' + isnull(Name1_First,'') VendorName, b.BusinessID 
from tblVendor_Payees p join tblVendor_Business b 
on p.PayeeID=b.PayeeID 
where VendorType=1 
order by isnull(Name1_Last,'') + ', ' + isnull(Name1_First,'') 

나는 단지 사람들을 나열 할을 위치 드롭 다운에 기반한 공급 업체 레코드 그렇게하는 방법?.

+0

당신은 tblContractTypes와 내가 선택하는 다른 테이블 중 하나를 선택해야합니다. –

답변

0

공급 업체 유형을 얻기 위해 별도의 select 문에 바인딩 된 데이터 인 드롭 다운 목록을 설정합니다.

쿼리 그런 다음 당신이해야 할 모든 사용자가에서 공급 업체를 선택 드롭 다운 목록을 구축이

SqlCommand cmd = new SqlCommand(); 
      cmd.CommandText = " 
SELECT p.PayeeID, isnull(Name1_Last,'') + ', ' + isnull(Name1_First,'') VendorName, b.BusinessID 
from tblVendor_Payees p join tblVendor_Business b 
on p.PayeeID=b.PayeeID 
where VendorType= @vender 
order by isnull(Name1_Last,'') + ', ' + isnull(Name1_First,'') " 

cmd.Parameters.Add("@vender", SqlDbType.VarChar).Value = drop_down_list_vendor .Text; 

처럼 보일 것입니다.

+0

질문을 편집하십시오. 지금보십시오 ... 그리고 대답을 변경하십시오. –

+0

gridview에서 컨트롤의 위치를 ​​기반으로하십시오. ? 예를 들어 (3) 열과 같은? – briskovich

+0

위치는 테이블에 드롭 다운입니다. http://pastebin.com/6kj3Uwmf –

관련 문제