这篇文章可以解决,从以前的帖子里找来的
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=ehYb6EmvCHA.2028%40TK2MSFTNGP11&rnum=2

解决方案 »

  1.   

    就是这样标记
    <EditItemTemplate>
      <asp:dropdownlist id="DropDownList1" AutoPostBack=True   OnSelectedIndexChanged="dl_SelectedChanged" runat="server">
      </asp:dropdownlist>
    </EditItemTemplate>
    这是触发事件
    public void dl_SelectedChanged(object sender, System.EventArgs e)
    {
      DropDownList list = (DropDownList)sender;
      Setcost_code(cost_code,list.SelectedItem.Value.ToString(),"");
    }
    注意将autopostback设为true就行了
      

  2.   

    Inyoureyes(最深的蓝) 这个不成啊,因为你给我的例子是在EditItemTemplate中进行,很容易取得编辑的是哪行,但我是直接点下拉菜单,不能像EditItemTemplate一样取得编辑的是哪行啊!怎么办?想想办法帮忙
      

  3.   

    不明白怎么不行。
    在SelectedIndexChanged事件中加一个判断就可以了啊~switch(DropDownList1.SelectedIndex)
    {
    case 0://代码1
    break;
    case 1://代码2
    break;
    }
      

  4.   

    mikespook(Mike大懒猫) 
    你可能没明白的我意思
    在datagird里有n行,每行有一个DropDownList1在SelectedIndexChanged里无法取得到底是哪个DropDownList1触发了该事件能帮忙想想吗?
      

  5.   

    DropDownList list = (DropDownList)sender;
    TableCell cell = (TableCell)list.Parent;
    DataGridItem row = (DataGridItem)cell.Parent;
    Response.Write(row.ItemIndex.ToString());
      

  6.   

    http://expert.csdn.net/Expert/topic/684/684952.xml?temp=.8887598