Print Page | Close Window

DataForm Lookup Fields

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1199
Printed Date: 28-Mar-2024 at 5:46am


Topic: DataForm Lookup Fields
Posted By: antalakas
Subject: DataForm Lookup Fields
Date Posted: 05-Apr-2009 at 4:31pm

Is it possible to use a Dataform with Devforce SL and create look-up comboboxes in the dataform?

I need a similar functionality like the one described here:
 
http://www.microapplications.com/blog/archive/2009/03/19/327.aspx - http://www.microapplications.com/blog/archive/2009/03/19/327.aspx
 
Thank you


-------------
Andreas Ntalakas



Replies:
Posted By: BenHayat
Date Posted: 06-Apr-2009 at 7:13am
I'll add my vote to add some sample how to populate combobox at runtime with DevForce!
Thanks!


-------------
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com - http://www.MicroIntelligence.Com


Posted By: ting
Date Posted: 08-Apr-2009 at 12:24pm

It's on our list now.  Thanks!



Posted By: BenHayat
Date Posted: 08-Apr-2009 at 1:14pm
Thank you Sir!

-------------
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com - http://www.MicroIntelligence.Com


Posted By: bigfish
Date Posted: 06-Aug-2009 at 5:58pm

I'm also looking for a clear example on how to do this please.



Posted By: WardBell
Date Posted: 24-Aug-2009 at 2:52pm

It's coming. It's not a DevForce problem per se; more of a Silverlight WTF. But we'll be giving some guidance.

Meanwhile, for inspiration look at Explorer.FormViewModelHolder in ModelExplorer and PrismExplorer. It addresses the same problem of needing access to the ViewModel of an outer control when you're inside a nested control and something changed the DataContext on the way through those control layers.
 
Dan Wahlin had an improved approach to the one cited earlier; read about it here http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx - http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx which deals specifically with your ComboBox issue.
 
The next version of FormViewModelHolder will inherit from Dan's DataContextProxy, eliminating some of my hook up code.


Posted By: antalakas
Date Posted: 25-Aug-2009 at 1:39am
Ward, thank you for your attention. I noticed this article last night after returning for vacation and i think it would be great to include DataContextProxy class in PRISM explorer.

A

-------------
Andreas Ntalakas


Posted By: WardBell
Date Posted: 25-Aug-2009 at 2:32am
@antalakas - Agreed. It will be in the next release of ME and PE (PrismExplorer) ... which will coincide with our DevForce 5.2.2 release coming up next week.


Posted By: pholloway
Date Posted: 18-Sep-2009 at 3:08pm
Not using a dataform --
 
What is the best quick way to make a Silverlight combo box do something actually useful - like display items from a lookup table, set the selected item to be the value associated with a customer record, and save the selected item's value back to the DB, for example?
 
Surely there is an easy way to do this?
 
Thanks.
 
 


Posted By: GregD
Date Posted: 25-Sep-2009 at 1:52pm
I wired up a ComboBox in the DataGrid in MainFormIntermediate in the solution for the FourSimpleSteps tutorial. It's bound to an Order's Customer, and displays the complete list of Customers to choose from.

The ComboBox there is just an ordinary one, used inside a DataEditingTemplate within the DataGrid column, so I believe the wiring would be similar used in a DataForm, or stand-alone.


Posted By: pholloway
Date Posted: 29-Sep-2009 at 10:43am
Thanks Greg, this is helpful. I see that you are loading Customer records into an ObservableCollection of Customers and binding that to the combobox. Now if you wanted to persist a changed Order record, is it a simple matter of calling Save against the entity manager -- in other words, is the FK relationship with Customer handled automagically, or do we need to do some extra stuff first?
Thanks again.


Posted By: GregD
Date Posted: 29-Sep-2009 at 12:54pm
Originally posted by pholloway


if you wanted to persist a changed Order record, is it a simple matter of calling Save against the entity manager -- in other words, is the FK relationship with Customer handled automagically, or do we need to do some extra stuff first?


That's all under your control. The safest -- and easiest -- thing to do is always to save all changes in your cache (orders, order line items, customers, products, everything) at the same time. That way, you don't accidentally save just part of a conceptual entity that spans more than one entity type (like an Order and its line items) and thus get data integrity issues.

On the other hand, there are use cases for saving only part of the cache, from a single entity on up, and you have the mechanisms to control exactly what gets submitted for a save. Under those circumstances, you have to take responsibility yourself to ensure that you don't create data integrity problems.


Posted By: pholloway
Date Posted: 29-Sep-2009 at 1:10pm

Greg, yeah, I'm definitely looking for "safest and easiest" at this point. Coming from a background of using stored procedures to do the heavy lifting, that model makes the most conceptual sense to me. Thanks!




Print Page | Close Window