|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DropDownList -- setting by text?hello,
what is the most-effcient manner to set the selected-item of an existing dropdownlist, when you only have the text (not the value) of the to-be-selected-item? currently, this is what im doing: ddlIFoo.SelectedValue = ddlIFoo.Items.FindByText(theText).Value; thanks! matt Matt, have you had problems with the FindByText and FindByValue method ?
I'd say its time to move on if this is working for you. From what you are trying to achieve, it seems to me that you want to Find-By-Text and are indeed using the right method. If you are unhappy with this, then you can manually loop through all items till you find a matching item whose ListItem.Text matches the Text you want to match, while setting that listItems.selected property to true. Not very elegant and unnecessary since you would be reinventing the wheel =P Regards, Alessandro Zifiglio http://www.AsyncUI.net <m***@mailinator.com> ha scritto nel messaggio Show quoteHide quote news:1154458116.164030.74640@h48g2000cwc.googlegroups.com... > hello, > > what is the most-effcient manner to set the selected-item of an > existing dropdownlist, when you only have the text (not the value) of > the to-be-selected-item? > > currently, this is what im doing: > > ddlIFoo.SelectedValue = ddlIFoo.Items.FindByText(theText).Value; > > > > thanks! > matt >
Events fired from dynamically created controls-VB.net
Set property in user control Dynamic button event not firing C# Correct place to add an event handler in code? Literal control rendering empty Referencing a parent control from a child? Adding layout elements within custom control How to Persist Dynamic Rows within WebControls.Table? customizing the dropdown menu of combo box in asp.net dropdownlist |
|||||||||||||||||||||||