asp.net-mvc

How do I divide URL parameters in a URL route?

How would I set up the URL routing for a scenario such as this: www.website.com/[project name]/News/Submit/[possible extra parameters] [project name] = a variable that will be needed by the action to specify which project News = Controller Submit = Action [possible extra parameters] = id I have yet to run into any examples of how to a...

Need help with Castle.Windsor as an Asp.Net MVC ControllerFactory please.

I'm trying to implement Steven Sanderson's WinsorControllerFactory from his pro Asp.Net MVC Framework book (great book, btw) and I'm stumbling into an issue. I'm not sure what else you'll need to know in order to formulate a response but I greatly appreciate any help in this. Thanks! Here's the code: WindsorControllerFactory public cl...

ASP.NET MVC best approach to provide data to Views

I'd like to to provide data to a table in the views. The data is not only from database but also from a csv file. Should I store the data in the ViewData, or should I store it in a object and pass it to views? What is the best approach, or any other methods I can use? Thx! ...

ASP.NET MVC return JSON() does show me a Save file Dialog

Hello together, My first Question on Stackoverflow, I am new on the .NET MVC pattern and tried to call a Action using AJAX.BeginForm Helper Class in my Controller I return seralized JSON using return JSON(); In my view I Added a Scrip witch should consume the returnes JSON. function ResultSet(request) { var json = content.get_r...

How To : PageView and Controllers inheritance in ASP.NET MVC

hi, if i wanted to add common functionality to all pages i create a BasePage and drive all ASPX pages from it, how can you do that to Pageviews and Controllers in MVC ? thanks in advanced. ...

Is generating Javascript Code and HTML Tags from HTMLHelper a Bad Practice ?

hi, maybe this is a stupid question, but i have seen many Tuts that build JavaScript ode and HTML Tags from an HTML Helper Extension Method like creating a Jquery Menu or Tree, it looks so neat and saves cluttering in View and encourage re usability. but i am wondering that because this code is generated on Server Side will it be slowe...

Linq To Sql validation

I have a class containing Linq To SQL objects that are used to populate drop downlists on a view. Using Scott Gu's Nerd Dinner I am implementing the validation framework they use, using partial classes. This works fine when working with one object for (example dinner) per view. But when I use a class that is not a Linq To Sql object, I c...

Best Practice : HTTP Handlers or ActionFilters for Optimal performance

hi, i use some HTTP Handlers from my Web Forms days forms, to for example Generate Images Thumbnails, Serving CSS, Etc... i like them, htey are easy to make and offer great abstraction, so can i still use them with optimal performance in MVC or should i use Action Filters ? thanks in advanced. ...

Creating MVC Views that are not HTML

This is a general question about MVC as a pattern, but in this case I am using ASP.NET MVC. I need to create an application whose output is an HTTP-accessed XML stream (content type text/xml). I can do this using traditional ASP.NET using a Generic Handler object. public void ProcessRequest(HttpContext context) { context.Response....

How does jQuery handle the click event?

I am new to jQuery and cannot get a selector to work using the id of the element. The code below works: $(function() { /* $("#ShowBox").onclick = ShowAccessible; */ document.getElementById("ShowBox").onclick = ShowAccessible; /* $(".searchcheck").click = ShowAccessible; */ }); function ShowAccessible() { $("tr.hide")...

Is WebServices or PageMethods needed anymore with ASP.NET MVC ?

hi, in Web Forms i used to create WeebServices and PageMethods to be able to call JSON results with jquery, so is this needed anymore with MVC ? ...

Is it possible to accept a List<Guid> as a paramater from checkboxes in Asp.Net MVC?

I know its possible to accept a list of objects as a parameter thanks to haacked but what about a list of Guids from checkboxes? This is a bit different as the only name you get has to be the ID. Any help would be greatly appreciated, thanks! ...

ASP.Net MVC - Add field to a Create form with add link (without javascript)

I have an MVC application which has a set of fields for contact details to be added for a person (Email, Phone, Fax, AIM... etc). Initially I present a dropdown for type of input and and input field for the corresponding data, along with a link to add a further set of fields. When complete I have a submit button to submit the form. I...

Why would I use ASP.NET MVC on a public site and WebForms on an Intranet?

I asked this question: http://stackoverflow.com/questions/894865/is-asp-net-mvc-destined-to-replace-webforms/895400#895400 and a few answers were that if the website were public/Internet to use MVC, but if it were internal to use WebForms. I saw some of the reasons for it but some of them didn't really help me understand why this rati...

EntityKey and ApplyPropertyChanges()

I need to set an EntityObject's EntityKey. I know its type and its id value. I don't want to query the database unnecessarily. This works... // // POST: /Department/Edit/5 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Guid id, Department Model) { Model.EntityKey = (from Department d in db.Department ...

MVC View - how to display the "category" of objects collection, not just the objects themselves

Using ASP MVC and Entity Framework. In the view, you have a page declaration that specifies the model for this view will be a collection implementing IEnumerable. Let's say that collection holds Car objects, that are only from Ford (Ford being the Category). <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" I...

Handling null values in asp.net MVC dropdowns

How do I create a dropdown in ASP.NET MVC that can handle a null value? The application is a lookup field in a database, where the primary key is in a lookup table, i.e. Categories, and the foreign key is in another table, i.e. CategoryID, but CategoryID is OPTIONAL (i.e. it can contain a null). I would imagine the generated markup in ...

ASP.NET MVC: clearing TempData after a controller method executes

From what I've read, information placed into TempData will be there for the current request and the next request (so that you can pass information across redirects). The problem is that if I browse to a controller action that does not redirect, the information in TempData will still be there for the next request. I'm using TempData to ...

What limitations does NDjango templates have over regular Django templates?

Are there any differences, limitations or gotchas between NDjango and Django templates? I'm specifically interested in implementing them in future ASP.NET MVC projects. I'm certain I won't be able to use any of my custom template tags that I've written for Django, but would I be able to port them to NDjango? ...

What are the best learning resources to teach ASP.NET MVC to an ASP.NET programmer?

What materials do you recommend for an experienced ASP.NET to learn ASP.NET MVC? ...