用templatecolumn来实现了
<asp:DropDownList ID ="test" Runat=server SelectedIndex ='<%#SearchIndex())%>'></asp:DropDownList>然后在.cs文件中public int SearchIndex()
{
 //计算出selectIndex}

解决方案 »

  1.   

    DropDownList.SelectedIndex = DropDownList.Items.IndexOf(DropDownList.Items.FindByValue(objArgs.Item.Cells[2].Text));
    objArgs.Item.Cells[2].Text为你数据集中的值 
      

  2.   

    Private Sub Datagrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles Datagrid1.ItemDataBound
            Dim dt As DataTable = aa.bbSelect(0)
            Dim drp As DropDownList = e.Item.FindControl("drp1")
            If Not drp Is Nothing Then
                drp.DataSource = dt.DefaultView
                drp.DataBind()             For i = 0 To drp.Items.Count - 1
                    If drp.Items(i).Value=... Then
                        drp.Items(i).Selected = True
                    End If
                Next
            End If
        End Sub