|
-
Jan 27th, 2009, 04:41 AM
#1
[2008] Do you bind to just TEXT for a COMBOBOX
I've got a combobox - style DropDownList.
Three options - blank, EMAIL or PHONE - these three are set at design time.
Do I just bind the TEXT property of the COMBOBOX to the field in the DATATABLE?
This appears to be working fine - but I'm a bit confused about the purpose of SELECTEDVALUE in all this. I'm not binding to that.
-
Jan 27th, 2009, 08:09 AM
#2
Re: [2008] Do you bind to just TEXT for a COMBOBOX
While the Text property is not strictly wrong in this case, it is more for use when the DropDownStyle is DropDown. It allows you to get the text that the user typed in when an item has not been selected from the list. When the DropDownStyle is DropDownList I would always use SelectedValue.
If you're adding strings to the list directly then you could use SelectedItem too but, again, SelectedValue is the "most correct". You should also note that, when you bind to the control and set a ValueMember, the SelectedValue is the only property that you can use to get the selected value from that column.
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
|