zoukankan      html  css  js  c++  java
  • 在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绑定事件
           

        }

  • 相关阅读:
    shell命令--chattr
    OCA读书笔记(1)
    shell命令--tree
    网络知识汇总(1)-朗文和牛津英语词典网址
    shell命令--touch
    CCNP交换实验(7) -- NAT
    shell命令--rm
    CCNP交换实验(6) -- NTP
    shell命令--pwd
    CCNP交换实验(5) -- 网关热备冗余
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/3712122.html
Copyright © 2011-2022 走看看