Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp.net mvc dropdownlist best practice

Reply
Thread Tools

asp.net mvc dropdownlist best practice

 
 
rodchar
Guest
Posts: n/a
 
      09-30-2009
Hi All,

Where's the best place to load up my dropdownlist? in the Model, View or
Controller?

Thanks,
rodchar
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      09-30-2009
=?Utf-8?B?cm9kY2hhcg==?= <> wrote in
news:6055B854-1E5E-45ED-8F6C-:

> Hi All,
>
> Where's the best place to load up my dropdownlist? in the Model, View
> or Controller?


Let's think this one through, using a bit of theory to get us going.

I am going to oversimplify this on purpose to illustrate (so please
don't correct me with technical bs):

In MVC, the model represents state. If you need to grasp its purpose,
think of it as a data construct. The view is an I/O construct where the
model is presented to user (the "viewer") so he can interact with it.The
controller contains behavior and is the piece that sends the proper
model to the view so it can be "viewed".

So here are the questions:

1. Is loading the DropDownList working with state?
2. Is loading the DropDownList required for the user to view the state?
3. Is loading the DropDownList application behavior?

Of these, if thought through, only one of the questions should yield a
yes answer.

The DropDownList, itself, is not state. Loading it is not application
behavior either. So this leaves only one place to logically load a
DropDownList.

The answer for binding UI elements is the View. The controller will make
the call to get the right model, but it does not bind it. And the model
should not be responsible for UI behavior.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
rodchar
Guest
Posts: n/a
 
      10-02-2009
I appreciate the detailed reply.
Thank you for the insight,
rod.

"Gregory A. Beamer" wrote:

> =?Utf-8?B?cm9kY2hhcg==?= <> wrote in
> news:6055B854-1E5E-45ED-8F6C-:
>
> > Hi All,
> >
> > Where's the best place to load up my dropdownlist? in the Model, View
> > or Controller?

>
> Let's think this one through, using a bit of theory to get us going.
>
> I am going to oversimplify this on purpose to illustrate (so please
> don't correct me with technical bs):
>
> In MVC, the model represents state. If you need to grasp its purpose,
> think of it as a data construct. The view is an I/O construct where the
> model is presented to user (the "viewer") so he can interact with it.The
> controller contains behavior and is the piece that sends the proper
> model to the view so it can be "viewed".
>
> So here are the questions:
>
> 1. Is loading the DropDownList working with state?
> 2. Is loading the DropDownList required for the user to view the state?
> 3. Is loading the DropDownList application behavior?
>
> Of these, if thought through, only one of the questions should yield a
> yes answer.
>
> The DropDownList, itself, is not state. Loading it is not application
> behavior either. So this leaves only one place to logically load a
> DropDownList.
>
> The answer for binding UI elements is the View. The controller will make
> the call to get the right model, but it does not bind it. And the model
> should not be responsible for UI behavior.
>
> Peace and Grace,
>
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> Twitter: @gbworld
> Blog: http://gregorybeamer.spaces.live.com
>
> *******************************************
> | Think outside the box! |
> *******************************************
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
mvc best practice rodchar ASP .Net 0 10-06-2009 01:02 PM
No MVC Project Template after installing ASP.NET MVC 1.0 Crazy Cat ASP .Net 1 09-03-2009 08:02 PM
WebForms X MVC? Why MVC? Give me reasons to migrate my web apps to it please. Pros x Cons! Thanks! Paulo ASP .Net 3 12-04-2008 03:00 AM
differences between Spring WebFlow,Spring MVC,and String Portlet MVC? rmn190 Java 2 01-10-2008 02:27 AM
Remember when your piano teacher taught you, "Practice, practice,practice ...?" Wayne Wastier Windows 64bit 3 06-10-2005 08:29 PM



Advertisments