Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2005, 03:56 AM
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to get value from dropdownlist

hi,

I can not get the value from the dropdownlist, please help me. Thanks a lot.
Here my code

'Connect database
        Dim DbPath As String = Server.MapPath("database.mdb")
        Dim ConnStr As String
        Dim SQL, b As String
        Dim ds As DataSet
        Dim a As Integer = 3
        ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DbPath & ";"
        Dim MyOleDbConn As New OleDbConnection(ConnStr)
        MyOleDbConn.Open()

        'Select the project name from the current user
        SQL = "SELECT * from project_investment where userID = 3"
        Dim MyOleDbCommand As New OleDbCommand(SQL, MyOleDbConn)
        Dim myda As New OleDbDataAdapter(MyOleDbCommand)
        ds = New DataSet
        myda.Fill(ds, "project_investment")

        'Fill data in droplist
        DropDownList1.DataSource = ds
        DropDownList1.DataSource = ds.Tables(0)
        DropDownList1.DataTextField = ds.Tables(0).Columns("Project_name").ColumnName.To String()
        DropDownList1.DataValueField = ds.Tables(0).Columns("Project_Id").ColumnName.ToSt ring()
        DropDownList1.DataBind()
        Dim i As Integer
        For i = 0 To DropDownList1.Items.Count - 1
            DropDownList1.Items(i).Attributes.Add("style", ds.Tables(0).Rows(i)("Project_name").ToString())
        Next

Sub projectrank()
        Dim b As String
        b = DropDownList3.SelectedItem.Text
        Response.Write(b)
    End Sub


       Private Sub projectrank_next_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles projectrank_next.ServerClick
        projectrank()
           End Sub

 
Old November 26th, 2005, 01:58 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Is AutoPostBack set to TRUE for the dropdownlist?

 
Old November 27th, 2005, 10:59 PM
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
the job was well done now. Thanks a lot

 
Old November 28th, 2005, 12:47 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Glad to help....

Jim





Similar Threads
Thread Thread Starter Forum Replies Last Post
dropdownlist sumith ASP.NET 1.0 and 1.1 Professional 1 February 23rd, 2007 09:11 AM
DropdownList Venkatesan ASP.NET 1.0 and 1.1 Basics 1 December 11th, 2006 11:03 AM
DropDownList chiraagb VS.NET 2002/2003 5 June 15th, 2004 03:12 AM
dropdownlist msrnivas .NET Web Services 0 March 4th, 2004 11:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.