mvc

Modelbinding database entities in ASPNET MVC

I'm having trouble trying to think what the best way is to recreate a database object in a controller Action. I want to make use of ModelBinders so in my action I have access to the object via a parameter, rather than having to repeat code to get an object from the database based on an identifier parameter. So I was thinking of having a...

MVC Namespace organisation

Hoping the SO community can help to resolve a debate in the office. At the moment our conclusion is 'it depends' ! In MVC, how do you organise your namespaces? Option A Do you go down the MS ASP.NET MVC route of having a Models, Controllers and Views namespace? Option B Or do you separate each MVC triad into it's logical 'functio...

need wcf and wpf application source code for beginer

Hi, I am beginner for .net 3.5, have to work on app where I need to build desktop version as well as web version for selected modules like reporting. I think WCF will help me out to create a base from where I could call functions in both(desktop as well as web ) Please let me know the any available source code sample projects to go thr...

Thunderdome MVC- Why one-model-in in MVC?

When Jeremy & Chad posted about their FubuMvc project, one of the differentiators they mentioned was their "Thunderdome Principal": The “Thunderdome Principle” – All Controller methods take in one ViewModel object (or zero objects in some cases) and return a single ViewModel object (one object enters, one object leaves). T...

What are the advantages of using an MVC framework over e.g. Drupal to build a large website?

I am writing a comparison between 3 technology options for building our new website: Wordpress Drupal An MVC framework The boss is sure we should use Wordpress, but the site will be big, with many sections, subsections, pages, and complicated templates. I'm finding it easy to compare WP + Drupal, but not so easy to state the additio...

From WebForms to ASP.NET MVC

This question is for anyone who has significant experience using ASP.NET WebForms who has made the switch to ASP.NET MVC. What was your business justification for making the switch? Do you consider the MVC platform to be mature? How long did it take for you to be productive using MVC (say 80% of your previous WebForms productivity leve...

ASP.NET MVC - CSS Class in a ViewUserControl - The class or CssClass is not defined.

I have a <table/> in a ViewUserControl that I have given the tag a class="tblRaised" attribute/value. Visual Studio keeps underlying tblRaised and telling me - The class or CssClass is not defined. Why is the intellisense engine trying to validate my CSS class names here? Anyone else run into this? Is this a bug? How would intellisense...

Html.Checkbox does not preserve its state in ASP.net MVC

I have this annoying issue with the checkbox created using the Html.Checkbox extension method. Apparently the state of the checkbox is not saved in case of a postback (due to a form validation error). Delving into the MVC code itself (System.Web.Mvc.Html.InputExtensions) I found out that the 'checked' property is determined by calling 'h...

how get ViewData in page load using Asp.net MVC and javascript

how get ViewData in page load using Asp.net MVC and javascript ...

PHP define scope for included file

I have quite a lot of PHP view files, which I used to include in my controllers using simple include statements. They all use methods declared in a view class which they get like $view->method(); However I recently decided that it would be better if the including would also be done by this view class. This however changes the scope of th...

Mocking Requirements for TryUpdateModel in ASP.Net RC1

I am in the process of writing some unit tests for my controllers in RC1. Here is the controller's public signature I'm testing: [AcceptVerbs(HttpVerbs.Post)] public ActionResult AcceptColleague() { The implementation inside the AcceptColleague uses the TryUpdateModel(colleague) method of populating the Colleague obje...

Best Way to Modify/Format Database Data in the Controller?

Let's say that in the controller I get an array of objects from the database this way: @statuses = TwitterStatus.find(:all, :order => "tweet_id DESC", :include => :twitter_user) Also I have the following loop in the view: <% unless @statuses.nil? -%> <ol> <% for status in @statuses %> <li><%= h(status.text -%>/li> <% end -%> </ol...

How do you refactor a Codeigniter controller function that is too long?

I have a function in my controller that has grown longer than I'd prefer and I'd like to refactor it to call a few discrete functions to make it easier to manage. How can I better organize a long function in a Codeigniter controller? What I've tried: I know you can create private functions in a controller by naming them with a leading ...

ASP.Net MVC View Architecture

Can the folders within the View have subfolders? if so, how does the Controller reach them? For example... I would like to have the following urls work correctly: Admin/Index Admin/Profile/Index Admin/Profile/Edit/1 Admin/Group/Index Admin/Group/Edit/1 So, would I create a folder for Profile and Group as a subfolder within Admin? I ...

asp.net MVC caching with Pagination.

Would using linqs deferred loading be preferred when implementing pagination? or should i cache the results and make repeated calls to it as the page is selected? When the cache refreshes, I will reload the results, but the results may change and thus the pages with it. ...

in MVC/MVP/MVPC where do you put your business logic?

in the MVC/MVP/MVPC design pattern where do you put your business logic? No, I do not mean the ASP.NET MVC Framework (aka "Tag Soup"). Some people say you should put it in the "Controller" in MVC/MVPC or "Presenter". But, others think it should be part of the Model. What do you think and why? ...

Best way to learn about .net MVC for a php programmer

Ok i know theres a ton of questions around books and tutorials to learn MVC in dot net, BUT after I started reading some of that stuff i realized they are not oriented to people like me. I have been working with php on Zend in a MVC configuration and done some ruby on rails so i do have a good idea of the pattern, but i have absolutly ...

Numeric Dropdown that 'turns into' a textbox when I select 'More'

I need to make a dropdown that has the numbers 0 through 10 in it, plus a "--More--" option at the bottom. If the user selects '--More--' then I want the dropdown to 'turn into' a textbox so they can enter a numeric value. I want the field name posted back to have the same form value regardless of which entry method was used. Preferably...

ASP.NET Membership, Roles and AllowPartiallyTrustedCallers

Hello, I have a ASP.NET MVC website with XML based membership and roles. I have the ReadOnlyXmlRoleProvider and ReadOnlyXmlMembershipProvider deployed in bin-folder as two signed dll's. The site works perfectly on one service provider's new platform (IIS 6 + full trust), where I've tested it. I had to ask for Wildcard Mapping, to get t...

Converting from Web Forms to MVC

Has anybody gone through the process of converting a real-world business application from ASP.NET web forms to MVC? How painful was the transition? Would you say that it was worth it, overall? I am trying to figure out if it is worthwhile to take the time to convert an application over to MVC for increased performance. ...