Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComboBox, DataSource, DisplayMember and ValueMember
Message
From
01/11/2005 12:20:52
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01063988
Message ID:
01064090
Views:
13
Einar,

And as you may have figured out already, you can also just specify "ProductID" rather than oDT.Columns["ProductId"].ToString() when using a DataTable as your DataSource as well ... it's not just applicable to DataViews. In fact, I prefer it that way ... much easier to read. =)

~~Bonnie



>Just like I thought it was a very simple question (I must try to think about coding instead of watching SWIII later today).
>
>this.cboProduct.DataSource = this.oDV;
>this.cboProduct.DisplayMember = "Name";
>this.cboProduct.ValueMember = "ProductId";
>
>
>Einar
>
>>Probably just another simple question. I use the following code to populate a ComboBox (oDT is a DataTable):
>>
>>this.cboProduct.DataSource = oDT;
>>this.cboProduct.DisplayMember = oDT.Columns["Name"].ToString();
>>this.cboProduct.ValueMember = oDT.Columns["ProductId"].ToString();
>>
>>
>>Earlier this morning I got this crazy idea to use a DataView to populate the ComboBox, but I can't seem to figure out how to set the DisplayMember and ValueMember when the DataSource is a DataView.
>>
>>Any assistance would be appreciated.
>>
>>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform