mvc

Avoiding nil in Rails views

I'm sure this has been asked already, but I can't find the answer. I have a Project model, which has a belongs_to relationship with my Client model. A client has a name, but a project doesn't necessarily have a client. In my view, I've got code like this: <%=h project.client && project.client.name %> because if the project doesn't h...

ASP.NET MVC - The controller for path '/non' was not found or does not implement IController.

I use the jQuery Tools Overlay plugin and I have this code here <script type="text/javascript"> var overlayElem; $(document).ready(function () { $("a[rel]").live('click', function (e) { e.preventDefault(); overlayElem = $(this); $(this).overlay({ ...

ASP.NET MVC - Return JavascriptResult and Json parameter

Here is the scenario In MVC, it is easy to return a Javascript to be executed on the client public ActionResult DoSomething() { return JavaScript("alert('Hello world!');"); } On the client, I have a Javascript that takes a JSon object as parameter Something similar to this : function open(options) {...} I ...

How can I render an image in asp.net mvc?

I have a sample I'm building, that's using the Northwind database. I have a view in which I show all the products for a specifc category and use a ul to generate items with an image and the products name and price. I have used the code here, http://blogs.msdn.com/b/miah/archive/2008/11/13/extending-mvc-returning-an-image-from-a-controll...

asp.net mvc and unicode routes and links

Hi all, I'm developing a unicode web application (in hebrew). and my route looks like: "SomeUnicodeHebrewWord/{CategoryId}/{CategoryName}/{Page} When i use the actionlink the SomeUnicodeHebrewWord and CategoryName (also in hebrew) are getting html encoded. how can i avoid that? can't i have the links created with th hebrew characters? ...

Html.Telerik().StyleSheetRegistrar() output file generating 404 message on asset.axd

I'm using the Telerik controls form MVC and they work great in my work/home dev environments, and in the work prod environment, but when I tried to deploy to my home prod environment (IIS7) I get a problem. I've added the axd mime type, but wan't sure what else to do. I read a post suggesting adding a handler, but wasn't sure if I'm se...

Updating value provider prior to TryUpdateModel

Lets say we have a class with a property called PetsName. If it is left blank on the screen I want to update the value provider so if the user doesn't enter a pet name, we force 'unnamed'. This isn't the actual scenario.. this is of course a sample, so answers like 'just set default values on a webpage, etc' won't fit this scenario : ) ...

asp.net mvc c# image upload page crashing

i am uploading an image ,when uploading image of a very large size the application crashes . i am checking the image size as well . but uploading image of a very large size bypass everything and crashes the application. What do u people suggest? what is the best practise? ...

How do I dynamically create a named_route in rails?

I currently have this in my ApplicationController def account_path eval "#{current_user.type.downcase}_account_path" end I use it for redirects, etc. But I also want to use it in the view (for link_to's etc). Is this is a legit case to share code between the controller and view to keep it DRY even though it breaks MVC? ...

NotFound Controller on mvc website

On A c# mvc website, I created a controller with the name NotFound, and then created a default route to an index action on the controller. When I debugged the program it went to the correct controller action but did not display anything in the view. Does any one know why? ...

ASP.Net MVC 2 - How to stop the view from using prefixes on fields?

ASP.Net Html.TextBoxFor (and the other XxxxxFor editor helper methods) default to rendering a field prefix. How do I disable field prefixes so it simply renders the property name as the Name/ID? Here's an example: <%= Html.EditorFor(m => chart.Title) %> is rendered as: <input id="Chart_Title" name="Chart.Title" type="text" value="">...

What, specifically, belongs in a Model, a View, and a Controller?

I've been learning about the Model-View-Controller paradigm ("MVC"), but I'm quite confused since some tutorials contradict other tutorials. My current understanding of the process looks something like this: Router / Dispatcher / Front Controller: Though not specifically referenced in the "MVC" name, the Router is still a very import...

VB.NET Web Application Project cannot add merge with C#.net mvc project

Hi, I am trying to merge my vb.net Web application project with my c# mvc project not ideal at all but the project is too big to do it any other way. any ideas would be much appreciated! Thanks Ash :D ...

In Asp.net MVC, is it advisable for viewmodels to derive from domain models?

(I am using ASP.Net MVC, but this seems like a more generic MVC question) Say you have a domain model representing a person, and you have a view for editing a person. Included in the Person domain object is a State of Residence property, and in the view you want a dropdown that lists states. Is there any reason not to create a view ...

ASP.NET MVC web site template

Hi All, I would like to download ASP.NET MVC web site template. Please guide me where can i find and how i can use. I'm new to this pattern. Thanks in advance. ...

asp.net mvc linq to sql in scenario

i want to implement the "in" in sql in linq to sql .how can i do that ? ...

The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery`1[Models.MailListViewModel]'

Hi, I am getting an error saying: The model item passed into the dictionary is of type 'System.Data.Linq.DataQuery`1[WebUI.Models.MailListViewModel]', but this dictionary requires a model item of type 'WebUI.Models.MailListViewModel'. This is in my controller: public ViewResult List() { var mailToShow = from m in mailReposito...

How to localize MVC with database backed resources

I have read most of the literature Google and SO provides on this (correct me if I've missed something). What I am trying to do is to localize an MVC site using resources, I want the compiletime safety of strongly typed resource files (ResX) but the flexibility of the ASP.NET 2.0 Resource-Provider Model, or something similar to that. I ...

Default data for a view in codeigniter

When we load a view, we can pass some dynamic data to it. What I would like to achieve is when the view receives no data, it uses some default data that is loaded from a model (database). The problem is I don't really want to put these statements (that loads the default data) in the view. What is the simplest solution available, witho...

Automated MVC App Localization

The company for which I work for has built a large ASP.NET MVC application last year and it wasn't prepared to support Localization to begin with as the main goal of this application was to serve portuguese clients. But as the application took greater proportions, the demands were that it should support other languages, like english for ...