在GridView中创建下拉列表选择

时间:2018-09-10 10:27:14

标签: c# sql asp.net gridview drop-down-menu

我有一个gridview,它从存储过程中返回6列。

我需要最后4列作为下拉列表,以便它们可以更新并发送回数据库。我不确定如何执行此操作...下拉列表必须在列中选择不同的值才能在gridview中显示。谁能帮忙。

存储过程

DECLARE @Error VARCHAR(10)


IF @VendorID NOT IN (SELECT DISTINCT VENDOR FROM VendorDetailsVendorForUpdate) 

-- check for a valid vendor
SELECT @VendorID = (SELECT DISTINCT VENDOR FROM VendorDetailsVendorForUpdate WHERE VENDOR = @VendorID) 


    SET @Error = @@ERROR
    IF (@Error <> 0 OR @VendorID IS NULL)
    BEGIN
        RAISERROR( 'The value entered is not a valid VendorID',15,1)
        RETURN
    END  

-- if valid get the details for the update form
SELECT ID 

        , MaterialNumber as 'Item Number'
        , MaterialDecsription  as 'Item Description'
        , CountryOfOrigin as 'Country Of Origin'
        , ALCode as AL
        , ECCN
        , InfoPref as Preference


FROM VendorDetailsRecordsForUpdate
WHERE VendorID = @VendorID

我相信下拉菜单将通过项目模板进行填充?但是我该如何编写存储的proc,以便能够通过下拉列表更新最后四列?

0 个答案:

没有答案