|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DropDown Listfollow(s) <option value="id|description">description</option> where id and description are values that are pulled back from the database, I know I have seen this done before, but for the life of me I cannot remember how it is done. this is the code I set up to do this, but it does not work and I was hoping someone would be able to help out. Select Case iPopulateDrpDowns Case 1 drpUp.DataSource = oData drpUp.DataTextField = "description" drpUp.DataValueField = "id" & "|" & "description" drpUp.DataBind() Case 2 drpTo.DataSource = oData drpTo.DataTextField = "description" drpTo.DataValueField = "id" & "|" & "description" drpTo.DataBind() Case 3 drpDte.DataSource = oData drpDte.DataTextField = "description" drpDte.DataValueField = "id" & "|" & "description" drpDte.DataBind() Case 4 drpPeriod.DataSource = oData drpPeriod.DataTextField = "description" drpPeriod.DataValueField = "id" & "|" & "description" drpPeriod.DataBind() End Select Any help would be appreciated. thanks. -- J. Daly The best way to do this is to perform the concatenation in your query.
SELECT description, id + "|" + description AS id-desc FROM Table Then DataTextField = description and DataValueField = id-desc. -- Show quoteHide quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "JD" <jdn***@dalys.us> wrote in message news:eNx$$qnIGHA.3816@TK2MSFTNGP12.phx.gbl... >I am trying to see up a drop down list so that the key value is set up as >follow(s) > > <option value="id|description">description</option> where id and > description are values that are pulled back from the database, I know I > have seen this done before, but for the life of me I cannot remember how > it is done. > > this is the code I set up to do this, but it does not work and I was > hoping someone would be able to help out. > > Select Case iPopulateDrpDowns > > Case 1 > > drpUp.DataSource = oData > > drpUp.DataTextField = "description" > > drpUp.DataValueField = "id" & "|" & "description" > > drpUp.DataBind() > > Case 2 > > drpTo.DataSource = oData > > drpTo.DataTextField = "description" > > drpTo.DataValueField = "id" & "|" & "description" > > drpTo.DataBind() > > Case 3 > > drpDte.DataSource = oData > > drpDte.DataTextField = "description" > > drpDte.DataValueField = "id" & "|" & "description" > > drpDte.DataBind() > > Case 4 > > drpPeriod.DataSource = oData > > drpPeriod.DataTextField = "description" > > drpPeriod.DataValueField = "id" & "|" & "description" > > drpPeriod.DataBind() > > End Select > > Any help would be appreciated. thanks. > > -- > J. Daly > funny you should say that, because that is what I ended up trying, only I
called my field id_desc. I guess when you are working into the night the simple things seem to go out of one's head. Thanks for your help. Show quoteHide quote "Christopher Reed" <carttu@nospam.nospam> wrote in message news:%23JkJWKpIGHA.2896@TK2MSFTNGP09.phx.gbl... > The best way to do this is to perform the concatenation in your query. > > SELECT description, id + "|" + description AS id-desc FROM Table > > Then DataTextField = description and DataValueField = id-desc. > -- > Christopher A. Reed > "The oxen are slow, but the earth is patient." > > "JD" <jdn***@dalys.us> wrote in message > news:eNx$$qnIGHA.3816@TK2MSFTNGP12.phx.gbl... >>I am trying to see up a drop down list so that the key value is set up as >>follow(s) >> >> <option value="id|description">description</option> where id and >> description are values that are pulled back from the database, I know I >> have seen this done before, but for the life of me I cannot remember how >> it is done. >> >> this is the code I set up to do this, but it does not work and I was >> hoping someone would be able to help out. >> >> Select Case iPopulateDrpDowns >> >> Case 1 >> >> drpUp.DataSource = oData >> >> drpUp.DataTextField = "description" >> >> drpUp.DataValueField = "id" & "|" & "description" >> >> drpUp.DataBind() >> >> Case 2 >> >> drpTo.DataSource = oData >> >> drpTo.DataTextField = "description" >> >> drpTo.DataValueField = "id" & "|" & "description" >> >> drpTo.DataBind() >> >> Case 3 >> >> drpDte.DataSource = oData >> >> drpDte.DataTextField = "description" >> >> drpDte.DataValueField = "id" & "|" & "description" >> >> drpDte.DataBind() >> >> Case 4 >> >> drpPeriod.DataSource = oData >> >> drpPeriod.DataTextField = "description" >> >> drpPeriod.DataValueField = "id" & "|" & "description" >> >> drpPeriod.DataBind() >> >> End Select >> >> Any help would be appreciated. thanks. >> >> -- >> J. Daly >> > >
These controls are a real mess
DataSourceID '<NewDataSource ...>' not working in composite contro Global Themes Folder Missing .NET multi-column listbox for webpages? Menu Control building via code Gridview not updating database row TreeView Security error Catching event in Menu control when bound with sitemap Script edit server control multiview |
|||||||||||||||||||||||