如何将数据从表填充到gridview的下拉列表

时间:2013-11-13 06:57:23

标签: asp.net

gridview

中的下拉列表
<asp:TemplateField HeaderText="ProjectModifiedBy" HeaderStyle-BackColor="#C0C0C0" HeaderStyle-BorderColor="Black">
        <ItemTemplate>
              <asp:DropDownList ID="DropDownList1" Width="99%" runat="server">
            </asp:DropDownList>
         </ItemTemplate>                 
    </asp:TemplateField>

网络方法代码

     <WebMethod()> _
Public Function BindDropDown() As SqlDataReader
    Dim strConnString As String = ConfigurationManager.ConnectionStrings("conString").ConnectionString
    Dim sqlQuery As String

    sqlQuery = "Sp_SelectEmpName"
    Dim con As New SqlConnection(strConnString)
    Dim cmd As New SqlCommand(sqlQuery, con)
    cmd.CommandType = CommandType.StoredProcedure
    Dim reader As SqlDataReader
    con.Open()
    reader = cmd.ExecuteReader()

    Return reader
End Function

这是调用webmethod的代码隐藏方法,我应该写什么来将empname列数据与gridview下拉列表绑定

  Private Sub BindDataDropDown()

  End Sub

0 个答案:

没有答案