• 在GridView的中有一个DropDownList,并且DropDownList有回传事件


    在GridView的中有一个DropDownList,并且DropDownList有回传事件

     最近做一个项目,需要在GridView中的ItemTemplate中添加一个DropDownList,并且当我选择这个DropDownList得时候,他需要向服务器回传数据:

    如下图:

     

    一开始想在GridView中的事件中写呢,可是DropDownList又没有CommandName属性

    所以只有在DropDownList得SelecedIndexChanged事件中写了,具体步骤:
    在GridView得编辑状态下,双击DropDownList就会进入到下面的事件中,代码如下:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList Type = sender as DropDownList;  
            TableCell cell = (TableCell)Type.Parent;
            GridViewRow item = (GridViewRow)cell.Parent;
           string sql = "Update t_MemberInfo set YX=" + Type.SelectedValue+" and where Id="+item.Cells[0].Text;
            dal.RunSql(sql);
           gridViewBind();   / /GridView绑定事件
           

        }

  • 相关阅读:
    看盘技巧及要点
    棉花价格持续走高带来阶段性投资机会
    2009430远光软件,美锦能源
    c#获取汉字首字母拼音
    Linq分组查询统计
    json序列化
    jquery 实现飘落效果
    python学习开始
    DOS命令大全 DOS常用代码全在这里
    Python包含以下方法:
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/3712122.html
Copyright © 2020-2023  润新知