Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DropDownList initialization question
Message
General information
Forum:
ASP.NET
Category:
Web forms
Miscellaneous
Thread ID:
00900902
Message ID:
00900943
Views:
25
Kevin,

I have another related question...
My form has several DropDownLists on it. I want to populate them from tables, as I think I mentioned...
I want to use these lookup tables to allow the user to tell me what kind of condition to use to display data from my contacts table (all contacts from Florida AND etc etc).

I'm populating the DropDownsLists like this:
        '--------------------------
        ' Create the SelectCommand...for Contacts.Company
        '--------------------------
        oledbCMD = New OleDbCommand("SELECT DISTINCT Company " & _
                                            "FROM Contacts " & _
                                            "ORDER BY Company", _
                                    oledbConn)
        '
        oledbDA.SelectCommand = oledbCMD
        oledbDA.Fill(oledbDS, "CompanyLookup")
        '
        cboCompanyLookup.DataSource = oledbDS.Tables("CompanyLookup")
        '
        cboCompanyLookup.DataTextField = "Company"
        cboCompanyLookup.DataValueField = "Company"
        cboCompanyLookup.EnableViewState = True
        cboCompanyLookup.DataBind()
        cboCompanyLookup.Items.Insert(0, "")
        '--------------------------
however, when the user click on a button I provided to display the proposed condition, the form submits and reloads and now my DropDownLists have on data. Previously I had this happen so I placed the code to populate the DropDownLists, in the form load... problem was, I would lose the selections...

How do I resolve that????

Rick
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform