怎麽得到DropDownList的當前值?

解决方案 »

  1.   

    DataGrid每一行都有一个DropDownList?
      

  2.   

    将初始值放在一个隐藏列,与drplist的当前值对比
      

  3.   

    用.cell[i].FindControl方法找到这个drplist
    然后用.Value得到值
      

  4.   

    private void Button_Suc_Reg_ServerClick(object sender, System.EventArgs e)
    {
        DV_Ref = (DataView)Session["DV_Ref_myPage"];
        for(int intIndex = 0;intIndex<DV_Ref.Count;intIndex++)
          {
             //這裏作判斷,如果DropDownList的值改變則做處理
             if ()
              {
              }      }
    }
      

  5.   

    foreach(DataGridItem CurRow in DataGridName.Items)
    {
    DropDownList cbo=(DropDownList)CurRow.FinControl("DropDownListID");
    //取出cbo.SelectValue,就是你要的
    //。。
    }
      

  6.   

    回复人: jeremychin() ( ) 信誉:100  2005-01-08 17:08:00  得分: 0  
     
     
       将初始值放在一个隐藏列,与drplist的当前值对比=-----這個效率可能會高點!
      
     
      

  7.   

    囘:robin0925(棱石) 正是在用此种思路
      

  8.   

    為什麽查看
    DV_Ref[intIndex]["Field1"]的時候就有值
    而查看
    DV_Ref[intIndex]["Field1"].ToString()的時候就報錯?
      

  9.   

    怎么判断DataGrid中的DropDownList的SelectIndexChanged方法?