Click here to Skip to main content
15,905,587 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: reduce this big code Pin
Brady Kelly27-Jul-07 3:56
Brady Kelly27-Jul-07 3:56 
GeneralRe: reduce this big code Pin
duo!@#29-Jul-07 16:04
duo!@#29-Jul-07 16:04 
GeneralRe: reduce this big code Pin
Brady Kelly29-Jul-07 21:43
Brady Kelly29-Jul-07 21:43 
QuestionDeployement of web application Issue Pin
padmaja_200625-Jul-07 17:35
padmaja_200625-Jul-07 17:35 
QuestionMenu Control Formatting Pin
dwreck_stg25-Jul-07 15:50
dwreck_stg25-Jul-07 15:50 
AnswerRe: Menu Control Formatting Pin
dwreck_stg26-Jul-07 3:23
dwreck_stg26-Jul-07 3:23 
QuestionSSO Help Pin
Ridge Howison25-Jul-07 12:59
Ridge Howison25-Jul-07 12:59 
QuestionDisplay text with label [modified] Pin
ASPnoob25-Jul-07 12:48
ASPnoob25-Jul-07 12:48 
Hi, in the code below the first IF statement is used to determine if a list item is selected and the 2nd is used to determine if my database connection is not empty.
Dim DS As New DataSet
For i = 0 To CarNamesDL.Items.Count - 1
    If CarNamesDL.Items(i).Selected Then
        DBConn = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=CarCompaniesDB;User=myUser;Password=myPass;Option=3;")
        DBCommand = New OdbcCommand("SELECT CarID, Model From CarCompaniesDB where Make = '" & CarNamesDL.Items(i).Text & "'", DBConn)

    End If
Next
If Not IsNothing(DBConn) Then
    DBConn.Open()
    DBCommand.Connection = DBConn
    Dim AD As New OdbcDataAdapter(DBCommand)

    AD.Fill(DS, "CarCompaniesDB")
    Me.CarNamesDL.DataTextField = "CarID"
    Me.CarNamesDL.DataValueField = "Model"

    CarNamesDL.DataBind()

End If


This is the code for the button used to display the result, I don't quite understand it since I got it off the web.
Private Sub Bt_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_OK.Click
 lblDataSelected.Text = "Selected Text: " & CarNamesDL.SelectedItem.Text & "<BR> Selected value: " & CarNamesDL.SelectedValue & "<BR> Selected Index: " & CarNamesDL.SelectedIndex
End Sub


The following is the result.
Selected Item: Infinity
Selected Value: Infinity
Selected Index: 1


How do I get it to display the "Model" to the right of Selected Value: instead of displaying the text of the list item that was selected like its doing above? I'd like it to display the model name(s) that have been retrieved from the database. Thank you for your help.







-- modified at 18:58 Wednesday 25th July, 2007
AnswerRe: Display text with label Pin
Christian Graus25-Jul-07 13:05
protectorChristian Graus25-Jul-07 13:05 
GeneralRe: Display text with label [modified] Pin
ASPnoob25-Jul-07 14:03
ASPnoob25-Jul-07 14:03 
GeneralRe: Display text with label Pin
doWhileSomething25-Jul-07 16:37
doWhileSomething25-Jul-07 16:37 
QuestionDB2 problem? Pin
kidus125-Jul-07 11:15
kidus125-Jul-07 11:15 
QuestionProblem with IIS7 & ASP 3 (Two) Pin
mehrdadc4825-Jul-07 9:46
mehrdadc4825-Jul-07 9:46 
AnswerRe: Problem with IIS7 & ASP 3 (Two) Pin
Guffa25-Jul-07 10:20
Guffa25-Jul-07 10:20 
AnswerRe: Problem with IIS7 & ASP 3 (Two) Pin
Fred_Smith25-Jul-07 12:42
Fred_Smith25-Jul-07 12:42 
QuestionProblem with IIS7 & ASP 3 (one) Pin
mehrdadc4825-Jul-07 9:44
mehrdadc4825-Jul-07 9:44 
QuestionError : Attempted to read or write protected memory Pin
morteza5725-Jul-07 7:51
morteza5725-Jul-07 7:51 
QuestionEmail with multiple address Pin
Sam Heller25-Jul-07 7:37
Sam Heller25-Jul-07 7:37 
AnswerRe: Email with multiple address Pin
kubben25-Jul-07 8:23
kubben25-Jul-07 8:23 
QuestionHow to Populate a treeview with a file Pin
Edward LaPinski25-Jul-07 5:45
Edward LaPinski25-Jul-07 5:45 
AnswerRe: How to Populate a treeview with a file Pin
doWhileSomething25-Jul-07 11:19
doWhileSomething25-Jul-07 11:19 
Question2.0 Reference dataview control text in html??? Pin
munklefish25-Jul-07 5:19
munklefish25-Jul-07 5:19 
Questionregular expression for date Pin
rahul.net1125-Jul-07 5:19
rahul.net1125-Jul-07 5:19 
AnswerRe: regular expression for date Pin
Pete O'Hanlon25-Jul-07 10:22
mvePete O'Hanlon25-Jul-07 10:22 
Questionelement in masterpage in asp.net+c# Pin
mr.mohsen25-Jul-07 5:05
mr.mohsen25-Jul-07 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.