asp.net-mvc

ASP.NET MVC redirect from attribute

Hi, I'm trying to execute a Redirect from a method attribute. It seems to work: public class MyAttribute: ActionFilterAttribute { [..] public override void OnActionExecuting(ActionExecutingContext filterContext) { [..] filterContext.HttpContext.Response.Redirect(urlToRedirectTo, true); [..] The onl...

ASP.NET MVC Experiences/Success Stories [2010]

Hi, At the moment we're evaluating whether it's worth it to start using ASP.NET MVC in combination with Visual Studio 2010. I've been searching the web for experiences developers have had with working with ASP.NET MVC. I can't seem to find any. So I decided to post a question here. Are there any people out there that have used ASP.NE...

MVC2 Html Helpers

I generated a View using VS 2010 functionality. This auto code generation created this code: <%: Html.TextBoxFor(model => model.DateDeleted, String.Format("{0:g}", Model.DateDeleted)) %> I created a custom helper method (extension method) to create a JQuery Calendar control. This is the syntax for this control on the View: ...

Asp.net MVC route url

i can open a page (view) in browser using the address http://localhost:1234/Home/Details/id What settings i need in global.cs so i can open the same page using http://localhost:1234/Details/id ...

A public action method pagerror.gif / refresh.gif could not be found on controller - who is calling that gif?

Hello stackoverflow world. (This is the first time I actually post a question here. Exciting) A while ago I inherited a 2 year old MVC website from one of the teams within my corporation. I know most the ins and outs of this solution now but there is something strange cropping up in my error logs which I do not understand. Every now a...

Dynamic image and Ajax in ASP.NET MVC

I'm trying to show a detail partialview using ajax and colorbox. It's working fine but only the first time. After that GetGraph is not run and the first image is displayed again. If I reload the entire page it's working one time again. The detailinfo is updating OK it's just the chartimage that's not working. Somewhat related question ...

jQuery plugin dropdownchecklist wont update

I have a multiselect listbox with several different values, when a user selects values from first listbox another multiselect listbox gonna be populated with different values depending on the first listbox values. So far everything works as expected. The problem is that i'm using a jquery plugin called dropdownchecklist that transforms...

ajax call to C# method not working.

I want to call a method in C# from a client side AJAX/JQuery message. The client code is: function TestClickFunc(userId) { $.ajax({ url: "/Users/UpdateEmailDistributionListFlag", type: "POST", data: { "userId" : userId }, success: function (data) { ale...

How can I load a data table after the page loads ?

I would like to load data in a table but I would like to do this after the page loads. The actual page has a table, a textbox, and a search button. I was thinking ajax would help, but I am yet to find a good solution for my problem. How do I do this? Javascript, Jquery or otherwise. <table class="roundAll" > <tr class="titleRow"> ...

What is `confirmButton` in NerdDinner's ActionResult Delete?

In the NerdDinner MVC app demo, there is confirmButton defined when setting up ActionResult Delete: public ActionResult Delete(int id, string confirmButton) { What is confirmButton for, as it is not used in the code? I assumed it returned the name of the submit button that was clicked, but it is just a blank string. How can you get wh...

ASP.NET MVC: Use different databases for debug / release

How can I easily use two different databases for debug and release scenarios? I don't want to need to remember to change the data source connection strings every time I publish a new version of my application but I also don't want to test new code on the working database ... Is there something like a debug / release switch? ...

Help needed with syntax over how to make a database update from javascript

I am trying to get my head around MVC at the moment. What I want to do is this; function TestClickFunc(userId) { $.post("/Users/UpdateEmailDistributionListFlag", { id: userId }); } However I cannot use JQuery directly in a javascript method like this. I have been hunting around for examples, but now I need...

TryUpdateModel Not Working with Prefix and IncludeProperties

Hi i have an entity called User with 2 properties called UserName and Role (which is a reference to another entity called Role). I'm trying to update the UserName and RoleID from a form which is posted back. Within my postback action i have the following code: var user = new User(); TryUpdateModel(user, "User", new string[] { "UserNa...

asp.net mvc session for a user can they open multiple tabs? multiple browsers?

Hi, I am a bit confused on how ASP.NET session works with my site, when a user opens up the site in multiple browsers, and/or multiple tabs. I see that after logging in with IE, i can open a new tab and not have to log in, and that if I log out of one tab, the other one will redirect to login after I try to do something. I also notice...

How do I call a JsonResult from javascript?

I would like to call my JsonResult after a pageload, not on a submit button. I have two BeginForm functions. $("#loadTableForm").ready(function() { //$.post($(this).attr("action"), $(this).serialize(), function(response) { }); <%using (Html.BeginForm()) {%> //data <%using (Html.BeginForm("LoadTable", "Home", FormMethod.Pos...

Strange lag in http pipeline with ASP.NET MVC on IIS6

I have an ASP.NET MVC application running on IIS6 with enabled wildcard mapping. After performing some load tests I digged into log files with focus on the slow requests. I have a log file from the load testing application, IIS log file and the log file from the IHttpModule I develop for this purpose which records time of Application.Beg...

asp.net mvc opening a view in new window without master page?

I am wondering if it is possible to open a view in a new window but without the masterpage defined in the header? would I just define a separate view? or is there a better way? thanks! ...

New to TDD in asp.NET, am I on the right track writing tests?

I've been reading a lot on TDD over the past few months and decided to jump in and try it out with an easy example, I'm just not sure I'm testing for the right things in practice. Here the tests for a custom Data Annotation for validating emails: using System; using System.Text; using System.Collections.Generic; using System.Linq; using...

asp.net-mvc jquery dialog url with target=_blank doesn't work

Hi, I have a jQuery dialog showing a few items, with a link to open the item's order information in another window. This works fine on a regular view, but when I use target=_blank on a jQuery modal dialog, it does not open another browser window and instead navigates the page under the dialog to the URL. Any ideas how to work around th...

ASP MVC: Why aren't my internal classes visible from my Views?

Dear SO surfers, <ul> <li><% Html.ActionLink(StringHelper.TryGetLocalString("Something"), "Blah", "Blah"); %></li> </ul> I had tp make the StringHelper class above public before I could see it from within my partial view. Why?? (side note: resolving to local string will be done in my controller not in the view (layout) ...