asp.net-mvc-2

ASP.NET MVC 2 Input ID

Adding the following to my view: <input type="text" runat="server" id="newBookingRef" name="newBookingRef" /> Results in the following HTML: <input type="text" id="MainContent_newBookingRef" name="ctl00$MainContent$newBookingRef"> If I use the helper method Html.Textbox, the ID is generated as I would expect "newBookingRef". How c...

asp.net mvc ajax.beginform file upload

is there a way i can file upload using ajax.beginform as i am using jquery dialog and can't use html.beginform Basically i am implmenting a sort of wizard for initializing website on jquery dialog which need to have ajax there ...

handling textarea input to preserve paragrahs

I have an MVC 2.0 application that takes multiline input from a textarea, then displays the text somewhere else. I would like to have at least paragraphs preserved. Currently I use the TextArea helper for the form, then Html.Encode the value again when I output it. // form view <%: Html.TextAreaFor(model => model.Text, new { cols = 80,...

mvc contrib grid

Hi, I am just wondering whether it is possible to sort by 'combined columns' now (mvc contrib grid)? I know it says here that it is not possible - at least at the time of posting at this site - but things might have changed in the meantime. This is an example of a combined column in the view: column.For(x => String.Format("{0} {1}", ...

When using EditorFor() on a collection, is it possible to return the index of the current iteration?

I'm using an EditorFor() <%: Html.EditorFor(model => model.documentInfo.destinations)%> instead of a foreach <% foreach (var item in Model.documentInfo.destinations) { Html.RenderPartial("Document/Destination", item); } %> Is it possible to get the numerical index of which item the EditorFor() is displaying? Edit: I w...

ASP.NET MVC 404 Errors for IIS 7 Integrated mode

Hey everyone. I am getting 404 errors when I try to access my ASP.NET MVC 2 site. I'm hosting this site using II7, and I have my site set to use the DefaultAppPool Intergrated pipeline mode. Here's my routes, it's a pretty basic site: routes.MapRoute( "DefaultRoute", // Route name "{controller}/{action}/{...

The value for a object inside a viewmodel lost on redirect to action in asp.net mvc 2.0?

I have a view model - public class MyViewModel { public int id{get;set;}; Public SomeClass obj{get;set;}; } public class SomeClass { public int phone{get;set;}; public int zip{get;set;}; } So on my controller when I post back MyViewModel it has all the values for all the fields...but when I do return RedirectoAction("Som...

Very long running XmlHttpRequest

I am writing an application which needs "near real-time" updates from a browser app. The other requirement is that it use as little as possible bandwidth (so polling is not an attractive option). My idea is to use an XmlHttpRequest and just let the server wait to respond to that request until there is something to send back. This coul...

jQuery AJAX POST not working

I am trying to post some data from one local asp.net mvc site to another but am unable to do so. I execute the following post on site A // tried this and it didn't work //$.post("http://localhost/PlatformPortal/Buyers/Account/SignIn", //{sign:authHeader}) // Currently trying this $.ajax({ url: "...

ASP.NET MVC2 Authentication form with localization

I have two level authentification, first the user enters their nt/password and it is validated by LDAP and afterward I have a custom role provider that make sure the user has access to said page. That being said, in my web.config I have: <authentication mode="Forms"> <forms loginUrl="~/Account.mvc/LogOn" timeout="2880"/> </authentica...

I am not "getting" ModelBinders in MVC 2

I understand that a ModelBinder is a good place to do work on the request so that you keep that type of code out of the controller. Working with Form Values would be an example. That seems to makes sense however, I inherited an application that is using a Custom Binder and I just can't seem to figure out how or why it works. The binde...

mvc2: facebook entries for a given user

On an asp.net MVC2.0 driven website, what is the best way to show the entries from facebook for a given user? Are API from facebook stable/easy enough to be used within MFC2.0? ...

ASP.NET MVC 2 projects don't recompile?

I have this very strange issue with my MVC 2 project. Often times, I'll edit some code and there will be a compile error. If I hit F5 to debug, the error goes way even though it isn't resolved. I usually don't notice this and I then keep working, hitting F5 to debug and get extremely frustrated when my changes don't show up and when my b...

Binding two objects of the same type in an action

I have a page that collects information on two objects of the same type. When the page is submitted the action that handles the processing of the information submitted is attempting to use model binding, something similar to: public ActionResult Submit(Person parent, Person child) { //Do some stuff } It manages to bind one of th...

How to have a common bin/reference folder in asp.net web application/project when deploying?

I have a solution with about 10 different projects - I have a single class library that I am using in quite a few web projects. The problem when I am going to deploy these projects...they are going to have their own bin directories and hence references to this library...so i would need to update the reference on all 9 places/projects whe...

asp.net mvc 2: online user

In asp.net mvc2, how do I show the status of a user as "online"? So if the user is actively working on the site, the status would be "online". if the user stepped away from the site for about 5 minutes then it would be "5 minutes". if the user stepped away from the site for about 10 minutes then it would be "10 minutes". So on and...

jQuery AJAX POST variables not accessible on server

I am using jQuery to post some data to an asp.net mvc site. The post takes place successfully and the target controller action is hit when I debug it in Visual Studio, however it seems that the data I am passing is not getting carried over. I can't see it either in Request.Params or Request.Headers My post is as follows: $.ajax({ ...

Aspnet MVC 2 - 1 Project / Multiple Areas and common navigation menu.

Hi I am new to aspnet and MVC, I am developing an web application, which may over time have a number of sub applications, e.g. blog, shop, admin etc. I have started off creating an area for each of these sub-applications. I want to have a common navigation menu at the top of all pages within the application and a sub-application menu ...

ASP.NET MVC 2 - How to ignore an entire directory using IgnoreRoute?

I've tried the following two methods to try and ignore my "Assets" folder, but I keep coming up with errors. Can anyone tell me exactly how the Ignore Regex is supposed to look? routes.IgnoreRoute("/Assets/") routes.IgnoreRoute("{*assets}", New With {.assets = "\/Assets\/(.*)"}) ...

How do I replace my HTML Submit button with an ActionLink?

I have a view with a submit button. I also have a few ActionLinks on the view. Everything is function right now but I want to repalce the ugly button with an ActionLink to match the rest of the controls that are part of the view. I'm new to MVC. So far, I tried converting the button to a link but I need to post the form, which an action...