Populating a DropDownList with a Business Object


Author
Message
PeterA
PeterA
StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)
Group: Forum Members
Posts: 72, Visits: 235
I'm having some trouble getting a DropDownList to populate from a business object. I can get the page to load, but nothing shows in the object.



The business object is getting populated with the four records from the database to indicate a type, but these same four records aren't being transferred into the DropDownList.



1) PopulationType = "BusinessObject"

2) I've tried setting the "Method to Execute" option for PopulationDataSourceSettings to "Add()" and "Refresh()"

3) I've tried various combinations of settings for "PopulateOnPostBack" and "BindingDirection"

4) The same DropDownList is bound to a second business object where the unique key from the child business object is put into the foreign key field.



The binding piece doesn't seem to be a problem, but it keeps showing a blank drop down list. Is there something I'm missing? Something in my code to kick off populating the list?



Thanks for any help!



Peter
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, the root of the problem is the MethodToExecute.  When you use the SF list population, we create a new business object of the specified type behind the scenes and call the MethodToExecute on it to populate it; the list is then populated from this business object.  So, try changing your method to execute to a Fill method or a CopyDataFrom method to get the data into the business object we create behind the scenes.  And if you need to pass any parameters to the method, check out the ListPopulating event and pass the values into the collection on the event args.
PeterA
PeterA
StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)StrataFrame Novice (72 reputation)
Group: Forum Members
Posts: 72, Visits: 235
Ben Chase (09/10/2007)
Yep, the root of the problem is the MethodToExecute. When you use the SF list population, we create a new business object of the specified type behind the scenes and call the MethodToExecute on it to populate it; the list is then populated from this business object. So, try changing your method to execute to a Fill method or a CopyDataFrom method to get the data into the business object we create behind the scenes. And if you need to pass any parameters to the method, check out the ListPopulating event and pass the values into the collection on the event args.




Hmm.. Well, not how I ended up going about it, but I guess there's more than one way to skin a cat. BigGrin



I ended up tweaking my BusinessLogicLayerManager (BLLM) dictionary to filterthe business object better and then looped through it to add the items to the list. It probably wasn't the cleanest way, but it worked and I'm getting the result I wanted. I'll have to figure your method out when I'm not under a time crunch. Smile



Thanks for the info!



Peter
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can also use the DataSource, DataTextField, DataValueField, and DataBind() members.  You would then get a business object the way you want it, set the CurrentDataTable or the CurrentView as the DataSource, set the column name for the DisplayTextField and DataValueField properties and call DataBind().  That's the basic way to bind a list to the data source in the .NET web controls.
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