asp.net-mvc

What place for server controls in ASP.Net MVC?

Hello. What is the recommended replacement of ASP.Net server controls in the bright new world of ASP.Net MVC? In my opinion, one of the best features of ASP.Net is the ability to write server controls (although, admittedly, the event model is horrendous to deal with). If these controls are self-populating, then they can be shared betwee...

Add linq-entities association in MVC controller

Hi, in this MVC tutorial it showed how to decouple Controller from database logic using Repository and a Service layer. However the example is for a very simple model of pure properties. What about associations? Say if Product model has an association to the Users table through Owner association. The controller calls the service or the ...

trailing slashes on asp.net mvc urls with IIS 7

I'm using asp.net MVC on IIS 7 / windows 2008 server. The problem is that asp.net mvc generates urls with no slash at the end, like: http://site.com/category/asp. When this url is clicked, IIS 7 probably thinks its a directory and issues a 302 redirect to http://site.com/category/asp/ (with the end slash). How do i change this? I do no...

find referring page in asp.net mvc after a jquery redirect

I am faking an autopostback using jquery since I am using asp.net mvc. It's being performed in a select list (dropdownlist) like this: $(document).ready(function() { // autopostback for character drop down list $('#playerCharacters').change(function() { var charId = $('#playerCharacters option:selected').val(); w...

Is dynamic compilation in a 'ASP.NET Web Application' possible?

Hi, Can I somehow utilize the App_code folder in a web application project to compile code on the fly? It'd be great for plugins. Recently Rob Conery demonstrated its use in his talk at MIX 09 in a ASP.NET MVC app. I tried to do the same in a web app but I can't access the classes under App_Code from anywhere else. But if Rob was able t...

How to include a partial view inside a webform

Some site I'm programming is using both ASP.NET MVC and WebForms. I have a partial view and I want to include this inside a webform. The partial view has some code that has to be processed in the server, so using Response.WriteFile don't work. It should work with javascript disabled. How can I do this? ...

Jquery file uploader and navigator

I am looking for a jQuery plug in that will allow me to upload files and/or navigate to files on the file system. It would be used to allow a visitor to add multiple images to a news article. I am using ASP.NET MVC so it would have to be compatible with that. Edit: Something like this would work great - KFM Demo ...

Localization of ASP.NET MVC websites with GNU Gettext?

Hi, This might be an unusual question, but is there any framework or at least some helper classes that would help me use GNU Gettext for localizing a C# ASP.NET MVC website? I've been using Gettext in a previous (managed code) project and really appreciate the possibility to use PoEdit for translating the resources. I guess this would ...

ASP .NET MVC - Number of Controllers

Should there be a separate controller for each table that needs to be manipulated in a system? As an example, in designing an administration section of a content management system, should there be a separate controller for configuring each look up domain as follows: /DataTypeA/List --list for A /DataTypeA/Create -- create new data . ....

MVC Partial Views, Models and more

I am pretty new to ASP.NET MVC and I am trying to get my head around some of the design concepts at the moment. One thing I am currently stuck on is how (best) to handle a situation such as that described below. Suppose I have a page that needs to render a number of "sections". For example, on the left hand side there is a list that is ...

Is possible to use a data source control in ASP.NET MVC?

I want to use a LinqDataSource or ObjectDataSource with ViewData.Model, where ViewData.Model is an string array. I don't want to bind the datasource on view's PageLoad event. Is it possible? How? ...

ASP.NET MVC. Clean way to implement persistant sorting?

I still haven`t found any example of sorting implementation through paging in ASP.NET MVC (sort by name->press page 2->page 2 is still sorted by name). I could "hack" it, make it dirty, but i`m sure there have to be good "how-to" guides for this. What about sorting by two columns? ...

trying to submit rich text editor content in asp.net mvc and getting "potentially dangerous Request.Form value was detected"

I am using TinyMCE in asp.net mvc and getting the error message "a potentially dangerous Request.Form value was detected" when trying to save the text from the TinyMCE editor. I set ValidateRequest="false" both in web.config and on the page. Any ideas? ...

ASP .NET MVC correct UserControl architecture

I'm trying to learn the new ASP .NET MVC framework and would like to know the best practice for using UserControls. I understand that you can render UserControl's as a partial and pass data to them from a controller. Ideally I would think that it makes sense not to have a code behind file as this creates a temptation to break the MVC ru...

ASP.NET MVC: Do GET requests on private web pages have to be nondestructive?

In ASP.NET MVC it seems to be common practice not to use GET requests for calls to a controller that modify the model. For example, deleting a customer should not be possible by clicking a simple HTML link. The only reason for this rule I am aware of is not safeguard against web-crawlers which might indavertently alter the database. GE...

Views does not open in live MVC application

After I published my application none of links works in web site except default.aspx. When I clicked them "page not found" is shown. I guess, it is about routing. But I did not do any change on default mvc routing settings. What could cause this kind of thing? Thanks. ...

Diagnosing 404 errors on IIS 7 and ASP.NET MVC

I have an mvc app developed and tested with Cassini. Deployed to my site on GoDaddy, and the default page comes up fine. Click to log in, and I get a 404. I'm running under IIS 7 there, so this is unexpected. My routes are pretty plain: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Def...

ASP.NET MVC - Cascading Drop Down

I'm currently learning ASP.NET MVC and using Nhibernate. I would like to use Cascading Drop-Down Boxes. Has anyone managed to get cascading drop-down boxes working in MVC? Updated: I have looked at the following website: link text and used method 1. Controller Code var makeList = new SelectList(makeRepository.ListMakes (), "I...

How to use Rhino Mocks to Mock an HttpContext.Application

I'm new to Mocking frameworks and have started using RhinoMocks to assist with my MVC App Unit Testing. I'm using Scott Hanselmanns MVC Mock Helper to assist in mocking the HttpContext. I've succesfully (after some time) mocked some of what I need but have come unstuck when it comes to the Application property of the HttpContext. In my...

Null Reference exception with ActionLink

I have just upgraded from ASP.NET MVC Beta to the newly released V1 - however suddenly the code below is throwing a null reference exception. This was working fine before with no problems at all. Does anyone have any ideas? <%= Html.ActionLink<Website.Web.Controllers.PageController>(x => x.Edit(2), "Edit") %> ...