gridview的值存储在数据库中有下拉列表 [英] Store value of gridview having dropdown in database

查看:76
本文介绍了gridview的值存储在数据库中有下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个webform,其中放置了gridview,并在此gridview中有一个下拉列表。

来自gridview的添加列表。

现在如何添加gridview中下拉列表的值,显示时显示列表。

,当我填写表格时数据库中的值如何存储。

I Have a Webform in which gridview is placed and in this gridview having a dropdown.
that comes from add list from the gridview.
now how can i add the values to the dropdown in gridview that show list at time of display.
and when i fill the form how the value store in the database.

推荐答案

您好朋友,您可以访问以下链接:

[ ^ ]

- DD
Hello friend, You may visit the below link:
DropDownList in the GridView - Keeping asp.net forms control in GridView[^]
- DD


< text> 嗨朋友们,你的解决方案是:

<text>Hi Friends, Your Solution is :
protected void btnSave_Click(object sender, EventArgs e)
{
    List<int> list = new List<int>();
    foreach (GridViewRow r in gvOrder.Rows)
    {
        if (r.RowType == DataControlRowType.DataRow)
        {
            DropDownList ddl = r.FindControl("ddlDepartment") as DropDownList; 
                           
            int value = Convert.ToInt16(ddl.SelectedValue);
            list.Add(value);
           
        }
    }
}
</int></int>


这篇关于gridview的值存储在数据库中有下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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