asp.net-mvc

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 ...

Best sites for ASP.NET MVC RC Refresh Documentation

I am trying to figure out how to use ASP.NET MVC and it seems the only way to learn it is through reading blog posts. Scott Gu and Phil Haak are the two that come to mind. The problem I am running into is that alot of the documentation they write is relevant at the time and doesn't work in the latest versions. Is there a place that ha...

jquery getJson not passing any values to controller

I am trying to pass some text from a textbox to a controller to get JSON results like so function invokeAction() { var searchText = $("#SearchTextBox").val(); // Invoke MVC controller action $.getJSON("/Home/Results/" + searchText, bindResults); } If I put an alert here I can see that searchText definately...

Entity attachment issues in LINQ

I am trying to attach a LINQ entity to the data context after I receive it from a form POST. However, all I get is the following exception: An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy. I have also tried attaching the original row, like so: d...

How do I pass data from a controller to a strongly typed user control in asp.net mvc?

I have a strongly typed User Control which should show a user's orders on all pages, it's included in a master page. I have an OrdersController which can give me the current orders and is used at other locations. How do I tell the UserControl in the Master Page that it should get its Data from that specific Controller / Controller Actio...

Html.AntiForgeryToken() causeing errors after upgrading to .NET 3.5 SP1

I've just updated to .NET 3.5 SP1 and my once working ASP.NET MVC page has now stopped working. When trying to load a page I get the following YSOD [CryptographicException: Padding is invalid and cannot be removed.] System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCo...

Is there a tool to automate/stress POST calls to my site for testing?

I would like to stress (not sure this is the right word, but keep reading) the [POST] actions of my controllers. Does a tool exist that would generate many scenarios, like omitting fields, adding some, generating valid and invalid values, injecting attacks, and so on ? Thx Update: I don't want to benchmark/performance test my site. Just...

How can I update a page content with jQuery Ajax and ASP.NET MVC??

Hi!! I have a ActionResult named "MyPeriods(string dateSelected)" and in the end of it, I have a ViewData["periods"] = listOfPeriods (and after that, I have my return View(), fininshing up my method). When no "date" is passed, "date" is today, otherwise, "date" is the date passed as argument. And this "date" is important to select all t...

How should I select the right technology and platform for a project?

Here are some (certainly there could be more) of the guiding principles for a new project I'm starting. Addressable URLs Very fast Mobile - cater to iPhones and other smart devices Use existing social networks Live Facebook LinkedIn Twitter Craigslist Etc. Use existing ID services Live ID Open ID Etc. Client and online management a...

MVC action to response to jQuery Ajax requests, do I set doc type in header?

Hi, My .net MVC action is going to respond to ajax requests (jquery). Do I (or should I) set the document type of my header? I will be responding with either just html/plain text or maybe even JSON. ...

Request.Files Collection empty when passing from jQuery to ASP.NET code

I am running ASP.NET MVC Beta. I have an AJAX call running through jQuery which grabs my form values and posts them to a controller action. If I run this call without AJAX in a normal form post scenario, everything comes through correctly. However, once I incorporate the jQuery code, all the form values EXCEPT the files come through. Req...

Is there an official ASP.NET MVC reference/example app?

I'm struggling to find a good reference application for ASP.NET MVC. By "reference", I specifically mean an application that flexes all of the framework's features in the Microsoft-sanctioned manner, such as: Master pages Partial views Strongly-typed models Authentication Custom routes etc... The open source examples that are out the...

IsAjaxRequest is always false after upgrade to RC MVC

I updated the AJAX scripts and assembly referenced as per release notes. However, IsAjaxRequest still always returns false despite it actually being such a request. How do I resolve this? ...

ASP.net and Using Frameworks / Libraries / Methodologies

I have built several personal sites and now I and going to rebuild an existing one. I want to standardize on jQuery and Blueprint CSS. I used to use a Master page for everything but that does not seem to match real well with something like Blueprint. Not to mention the pain of the master page renaming of the controls ids and applying t...

How can I update a ASP.NET MVC ViewData via jQuery ajax?

Hi!! I have a page that highly depends on a IList (in ActionResult "MyEvents") that I pass in ViewData. Something like that: ViewData["events"] = listOfEvents; and in the end, I just return View(); And in my View, I take this ViewData["events"] and do a foreach in it so I can iterate through its contents. But, this ViewData must be dy...

Migrating Classic ASP - Webforms or ASP.NET MVC?

I'm doing some maintenance on a classic ASP application for my client, and as I'm looking through the ASP, the following question comes to mind - would it be easier to convert a classic ASP app to ASP.NET MVC or ASP.NET WebForms? In many ways, it appears that at least the HTML of ASP might be easier to convert to MVC than it would be to...

URLs for e-mailing in ASP.NET MVC

How would I generate a proper URL for an MVC application to be included in an e-mail? This is for my registration system which is separate from my controller/action. Basically, I want to send an email verification to fire an Action on a Controller. I don't want to hardcode the URL in, I would want something like the Url property on the...

SelectList returns as null in MVC DropDownList

Hello, I'm having problems using the Html.DropDownList helper on a MVC RC1 form. In the controller class, I create a SelectList like this SelectList selectList = new SelectList(db.SiteAreas, "AreaId", "AreaName"); ViewData["AreaId"] = selectList; or like this IEnumerable<SelectListItem> areaList = from area in db.SiteAreas ...

Can I use ASP.NET MVC together with regular ASP.NET Web forms

I have on request from a client built a huge site with ASP.NET Web forms. The problem is that I'm finding ASP.NET Web forms to be somewhat unintuitive (my personal taste only). So what I would like to do is use MVC but I can't really expect my client to pay for my time on a complete rewrite (nor do he have the time). So what I'm asking...

How can I sort a List<T> when the user clicks on a table header?

I'm writing an asp.net mvc app and I've get a list of service calls that I display in a table. When the user clicks the table header I want to tell my controller to sort the list by that column. public ActionResult Index(int? page, string sortBy, string sortDirection) { int pageIndex = page == null ? 0 : (int)page - 1; ...