PC Review


Reply
Thread Tools Rate Thread

Best Practices Question for MVC

 
 
Bill Gower
Guest
Posts: n/a
 
      10th Jan 2009
I have been puzzling over this for a while and I would like to hear from
those who have written quite a few windows apps as to your opinions.

I have a form that displays a grid showing a list of customers. The user
clicks one of the rows and a detail form appears that show information about
a particular customer. What is the best way to do this?

1. Have the list form in the double click method of the grid grab the key
field and pass the key field to the detail form and have the detail form
look up the record to be displayed.

int id = getKeyFieldFromGrid();
MemberDetailForm form = new MemberDetailForm(id);
form.ShowDialog();

2. Have the list form call the controller class to look up the customer id
and then pay the customer object returned to the detail form to be
displayed.

int id = getKeyFieldFromGrid();
Customer c = controller.GetCustomerById(id);
MemberDetailForm form = new MemberForm(c);
form.ShowDialog();

3. Have a field in the controller class called currentCustomer which is an
object of the Customer class, call the retrieve method from the double click
method of the grid and have the returned object stored in the
currentCustomer field in the controller and then pass the controller to the
detail form which then displays the currentCustomer object of the
controller.

int id = getKeyFieldFromGrid();
controller.GetCustomerById(id);
MemberDetailForm form = new MemberDetailForm(controller);
form.ShowDialog();

Which option best practices MVC? If there are other options please tell me
what they are.


Thanks
Bill



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best Practices Question JimO Microsoft ASP .NET 5 7th Aug 2006 09:13 PM
Best practices question Al_C Microsoft VB .NET 4 20th Nov 2005 11:57 PM
Best Practices question RickB Microsoft Access Forms 1 2nd Jul 2005 02:03 AM
Best Practices Question =?Utf-8?B?Q2hyaXM=?= Microsoft ADO .NET 4 7th Feb 2005 02:04 AM
Best practices question. Sasha Microsoft VB .NET 3 26th Sep 2003 06:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 AM.