<asp:ListItem >男</asp:ListItem>
<asp:ListItem >女</asp:ListItem>

解决方案 »

  1.   

    从GridView 中找到DropDownList 如:(GridView1.Rows[0].Cells[0].FindControl("DropDownList1") as DropDownList).Text;  这个就是 找到第一行第一列(第一个单元格)里面的DropDownList 选中的值
      

  2.   

    <ItemTemplate> 
    <asp:DropDownList ID="ddlSort" runat="server" Width="98%">
      </asp:DropDownList>
     <asp:HiddenField ID="Hd_Sort" runat="server" Value='<%# Eval("BalSort")%>' />
    </ItemTemplate>
     protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)
      {
      if (e.Row.RowIndex != -1)
      { if (e.Row.RowState == DataControlRowState.Edit || e.Row.RowState == (DataControlRowState.Alternate | DataControlRowState.Edit))
      {
      ((DropDownList)e.Row.FindControl("ddlSort")).SelectedValue = ((HiddenField)e.Row.FindControl("Hd_Sort")).Value;
      }
      }
      } protected void gv_RowEditing(object sender, GridViewEditEventArgs e)
      {
      gv.EditIndex = e.NewEditIndex;
      string strSort = ((DropDownList)gv.Rows[e.NewEditIndex].FindControl("ddlSort")).SelectedValue.Trim();
      gv.EditIndex = -1;
      BindData();
      } 
      

  3.   

    <EditItemTemplate>
     <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='Bind("Sex")'>
    <asp:ListItem Text="男"></asp:ListItem>
     <asp:ListItem Text="女"></asp:ListItem>
     </asp:DropDownList>
    </EditItemTemplate>
      

  4.   

    <asp:DropDownList ID="DropDownList1" runat="server">
    <asp:ListItem ></asp:ListItem>
                                    <asp:ListItem Text="男"></asp:ListItem>
                                    <asp:ListItem Text="女"></asp:ListItem>
    加一个空项,如果你的数据库允许空值,可以再设置回去
      

  5.   

    我来解释详细通俗点:
        DropDownList 加载进GridView里面,想要知道某一行的DropDownList的值,需要通过后台在GridView中定位找到这行的DropDownList控件,才能进行取值。因为DropDownList加载进GridView中时,GridView每一行都会出现DropDownList控件,程序在运行时不能判断你具体操作的是哪一行DropDownList。
    DropDownList ddl = (DropDownList)gv.Rows[x].FindControl(“DropDownList的ID”);
    你需要取得值 = ddl.SelectedValue.Trim();
      

  6.   


    那个放在 gridview 里面的控件是不能在页面直接找到的 ,需要在gridview里面找到这个控件获取他的值才可以
      

  7.   

    gridview里的控件是需要通过gridivew的单元格来找的!~
      

  8.   

     把性别写在 dropdownlist的 text和 value 属性里面