如下
DropDownList1.DataSource= DR
DropDownList1.DataTextField = "你要显示的字段名"
DropDownList1.DataValueField = "你希望获得的值"
DropDownList1.DataBind参考
ms-help://MS.VSCC/MS.MSDNVS.2052/cpref/html/frlrfSystemWebUIWebControlsDropDownListMembersTopic.htm

解决方案 »

  1.   

    你可以直接把DropDownList的数据源指向Datagrid1,做一次数据绑定。试试!!!
      

  2.   

    dragontt(龙人)兄的方法不错DropDownList1.DataSource= DR
    DropDownList1.DataTextField = "你要显示的字段名"
    DropDownList1.DataValueField = "你希望获得的值"
    DropDownList1.DataBind
      

  3.   

    是这样么“龙人”,可是为什么DropDownList1里没有数据呢?sub Page_Load(Src As  Object,E As EventArgs)
        
        
                                        Dim myConnString As String = "Data Source=169;User ID=device;Password=list"
        
                                           dim myConnection As new OracleConnection (myConnString)
                                           dim mycommand as oraclecommand=new oraclecommand("select device_name from device_type",myconnection)
                                           myConnection.Open()
                                           dim DR as  oracledatareader
                                           DR=mycommand.Executereader
                                           DataGrid1.DataSource= DR
                                           DataGrid1.DataBind
                                         
                                          DropDownList1.DataSource= DR
                                          DropDownList1.DataTextField = "device_name"
                                          DropDownList1.DataValueField = "name"
                                          DropDownList1.DataBind
                                          myConnection.Close()
                                  End Sub</script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <p>
            </p>
            <p>
                <asp:DropDownList id="DropDownList1"  runat="server" Width="166px"></asp:DropDownList>
            </p>
            <p>
                <asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
            </p>
            <!-- Insert content here -->
        </form>
    </body>
    </html>
      

  4.   

    我想你不用dr而是用dataset可能就可以了
    或者不将dr绑定到datagrid
    或者先将dr绑定到dropdownlist
    我没有试过,你试试
      

  5.   

    为什么我的DropDownList1中的选项不管选什么?selecteditem.Text总是指示选择的是第一个选项??
    代码如下:
      怎么回事呢??谢谢!!
      sub Page_Load(Src As  Object,E As EventArgs)
        
        
                                        Dim myConnString As String = "Data Source=169;User ID=device;Password=list"
        
                                           dim myConnection As new OracleConnection (myConnString)
                                           dim mycommand as oraclecommand=new oraclecommand("select device_name from device_type",myconnection)
                                           myConnection.Open()
                                           dim DR as  oracledatareader
                                           DR=mycommand.Executereader
                                           DropDownList1.DataSource=DR
                                           DropDownList1.DataTextField = "device_name"
                                          DropDownList1.DataValueField = "device_name"
                                          DropDownList1.DataBind()
        
                                  End Sub
        
        
                                  Sub Button1_Click(sender As Object, e As EventArgs)
        
          Label1.Text=DropDownList1.SelectedItem.Text
        End Sub</script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <p>
            </p>
            <p>
                <asp:DropDownList id="DropDownList1" runat="server" Width="309px"></asp:DropDownList>
            </p>
            <p>
                <asp:Label id="Label1" runat="server"></asp:Label>
                <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
            </p>
            <!-- Insert content here -->
        </form>
    </body>
    </html