如何在选择第一个gridview下拉列的基础上填充gridview下拉列 [英] How to populate gridview dropdown column on the basis of selection of first gridview dropdown column

查看:64
本文介绍了如何在选择第一个gridview下拉列的基础上填充gridview下拉列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家,

我有一个带有两列的gridview.
第一列是InventoryType和
第二列是库存.

所以我在gridview的每一行中都有2个下拉菜单.

最初填充网格时,将为所有数据行填充InventoryType列.之后,该用户将选择第一行的InventoryType,在移动时,我要根据用户对InventoryType的选择填充同一行的Inventory下拉列表.

希望我的问题对大家都清楚.

请帮帮我.

预先感谢,

〜Amol

Hello Experts,

I have a gridview with two columns in it.
1st column is InventoryType and
2nd column is Inventory.

so I have 2 dropdowns in each row of the gridview.

When the grid is populated initially, InventoryType column is populated for all the data rows. After that user will select InventoryType of first row, at the movement I want to populate Inventory dropdown of the same row on the basis of InventoryType selection by the user.

I hope my question is clear to all of you.

Please help me out.

Thanks in advance,

~Amol

推荐答案

可以尝试以下代码-

Can you try the following code -

 <script language="javascript" type="text/javascript">
    function PopulateInventoryDropDown() {
        var InventoryDropDownID = event.srcElement.id.replace("InventoryTypeDDL", "InventoryDDL");
        // set the Inventory drop down list items here
    }
</script>


假设您已在模板字段中声明了DropDownLists,如下所示-


Assuming that you have declared DropDownLists inside template fields as below -

<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False">
    <columns>
        <asp:templatefield>
            <itemtemplate>
                <asp:dropdownlist id="InventoryTypeDDL" onchange="PopulateInventoryDropDown();" runat="server">
                </asp:dropdownlist>
            </itemtemplate>
        </asp:templatefield>
        <asp:templatefield>
            <itemtemplate>
                <asp:dropdownlist id="InventoryDDL" runat="server">
                </asp:dropdownlist>
            </itemtemplate>
        </asp:templatefield>
    </columns>
</asp:gridview>


这篇关于如何在选择第一个gridview下拉列的基础上填充gridview下拉列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆