|
-
Jun 17th, 2003, 02:06 AM
#1
Thread Starter
Frenzied Member
Value from DrpList
I have some problems getting the value from the selcted index of a dropdown List. Nothing happens when I click the mat-list. Here is my code:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
bindMaterialer()
End If
End Sub
Protected Sub bindMaterialer()
Dim strCn As String = "Provider=Microsoft.jet.oledb.4.0;"
strCn += "Data Source=" & Server.MapPath("priser.mdb") & ";"
Dim cn As OleDbConnection = New OleDbConnection(strCn)
Dim cmdText As String = "Select Id as matId, Materiale FROM MedieMatNy Order By Id"
Dim cmd As OleDbCommand = New OleDbCommand(cmdText, cn)
cmd.Connection.Open()
mat.DataSource = cmd.ExecuteReader()
mat.DataValueField = "matId"
mat.DataTextField = "Materiale"
mat.DataBind()
cmd.Connection.Close()
End Sub
Public Sub mat_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mat.SelectedIndexChanged
Dim strHpl As String = mat.SelectedItem.Text
Label4.Text = strHpl
End Sub
-
Jun 17th, 2003, 03:11 AM
#2
Hyperactive Member
might be an idea to check you have the "autopostback" property set to true
-----
Gary
Last edited by tailz; Jun 23rd, 2003 at 02:08 AM.
-
Jun 17th, 2003, 03:43 AM
#3
Thread Starter
Frenzied Member
Thanks, that was the only thing I forgot. Sometimes we're 2fast :-]
-
Jun 17th, 2003, 03:44 AM
#4
Hyperactive Member
glad I helped
-
Jun 20th, 2003, 08:27 AM
#5
Member
Thanx
I was facing the same prob ... you didnt help one guy but atleast 2 and am sure many more as well ....
You'll get life just for once so don't waste it .......
-
Jun 20th, 2003, 08:28 AM
#6
Member
Thanx
I was facing the same prob ... you didnt help one guy but atleast 2 and am sure many more as well ....
You'll get life just for once so don't waste it .......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|