string str = ((DropDownList)(e.Item.Cells[i].FindControl("关键字"))).SelectedItem.Text;

解决方案 »

  1.   

    我的更新是在sqldatasource中做的,我的取值方式是这样的:
    protected void GridSqlDataSource_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
            
            this.GridSqlDataSource.UpdateParameters["publishid"].DefaultValue = ((DropDownList)this.GridView1.Rows[this.GridView1.EditIndex].FindControl("editIssueDropDownList")).SelectedValue;        
            this.GridSqlDataSource.UpdateParameters["filename"].DefaultValue = ((FileUpload)this.GridView1.Rows[this.GridView1.EditIndex].FindControl("FileUpload2")).FileName;
            this.GridSqlDataSource.Update();
        }
    但更新到数据库后是空值。这是为什么?
      

  2.   

    this.GridView1.EditIndex这个有值?
      

  3.   

     foreach (GridViewRow gvr in GD_data.Rows)
    {
                    string a = dt.Rows[0]["status"].ToString();
                    DropDownList L1 = (DropDownList)gvr.FindControl("DDL_status");
    }
      

  4.   

    这个值是有的,ls的多看msdn吧,问题已自己解决,谢谢了
      

  5.   

    string str = ((DropDownList)(e.row.FindControl("dropdownlistID"))).SelectedItem.Text;
      

  6.   

    最完整的
    //更新
        protected void GV_Product_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            DropDownList ddl = (DropDownList)GV_Product.Rows[GV_Product.EditIndex].FindControl("DropDownList1");        
            Label lab = (Label)GV_Product.Rows[e.RowIndex].Cells[0].FindControl("lab_keepid");        //获得控件里的值
            int identitys = Convert.ToInt32(ddl.SelectedItem.Value);
            int id = Convert.ToInt32(lab.Text);
    }
    //编辑
        protected void GV_Product_RowEditing(object sender, GridViewEditEventArgs e)
        {
            Label lab = (Label)GV_Product.Rows[e.NewEditIndex].Cells[0].FindControl("lab_keepid");
        }
      

  7.   

    http://blog.csdn.net/xianfajushi/archive/2008/11/30/3413317.aspx
      

  8.   

    注意看你界面源代码底下的GridView中的编辑模板下是否有DropDownList,
       <asp:TemplateField HeaderText="用户Id" SortExpression="employeeId">
                        <EditItemTemplate>
                           编辑模板下应该放个你想得到模板
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateField>有的话才能找到