Listbox valueMember


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I am trying to use your listbox. I have set the PopulationType to BusinessObject and set the PopulationDataSourceSettings including specifying the ValueMember. This does not fill in the valuemember property of the control and if try to set that directly the popup menu only offers none. upon Execution I get:



InvalidOperationException

   Cannot set the SelectedValue in a ListControl with an empty ValueMember.



Source : System



Could you please straighten me out on this?
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Within the population data source settings, set the Value Member to whatever field you want to use as the selected value. Then, in the property sheet for the ListControl, right-click the ValueMember property name and select "Reset" from the context menu. When the list is populated at runtime, the ValueMember property will be dynamically set to the name of the dynamically created DataTable that is used as the list source.



Also, make sure the "Value Member" within the PopulationDataSourceSettings dialog is set to the name of a valid field on the business object.



If resetting the ValueMember property doesn't work, then make sure you're not setting the ValueMember anywhere in code. If that still does not work, post some screenshots of your configurations, and maybe I can make something of it.
Daniel Essin
Daniel Essin
StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I have attached a screen-shot.



The reset option is grayed-out on ValueMember.



I am also unclear about needing to set the BusinessObject property and the DataSource property. It seems like setting the businessObject would be sufficient. In any case I have tried it with and without the datasource being set and the control comes up empty.



I am populating a c1TrueDataGrid simultaneously from the same BO as a test and it displays data.
Attachments
ListBox.jpg (276 views, 99.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Daniel,

Could you please email the picture.  It was shurnk when added and there fore unreadableBigGrin  Thanks.

Daniel Essin
Daniel Essin
StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I can't upload anything. It says that I have used 480 of 512 kb.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There is more than one way to populate a list using a business object. The manual method which would entail you use the DataSource, DisplayMember, and ValueMember properties.  The other is to set the PopulationType to BusinessObject and set the PopulationDataSourceSettings property.  For an exmaple or a reference on how to do this, refer to this thread on the forum: http://forum.strataframe.net/Topic596-6-1.aspx .  If this doesn't help let me know.
Daniel Essin
Daniel Essin
StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)StrataFrame User (275 reputation)
Group: Forum Members
Posts: 235, Visits: 309
How would I set the DataSource, DisplayMember, and ValueMember properties?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
All listboxes have a DataSource, ValueMember, and DisplayMember as does a combo box.  To use those properties add something like this:

MyListBox.DisplayMember = "MyDisplayFieldName"
MyListBox.ValueMember = "MyValueFieldName - Usually a PK of some sort"
MyListBox.DataSource = MyBusinessObject.CurrentDataTable

That's it Smile

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search