asp.net-mvc

How do i pass an extra parameter to server using jqgrid and http method POST?

I'm doing something like the guy in this post: http://stackoverflow.com/questions/3311929/is-there-a-way-to-programatically-set-a-filter-in-jquery-jqgrid I'm using http method POST to to get data from my MVC2 project and i saw that you can add a parameter using GET doing like this: You can modify the url that jqGrid calls, and add the ...

MVC 2 Validation and Summaries

Hi, I am starting on MVC 2, and I was wondering how the validation summaries work? I thought that it would something similar to the ASP.NET web forms validation summary control. First of all, I am doing simple validation, which of these .js files are required? <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/...

MVC Simple model binding not working

Okay, this has got to be something stupid-as-a-box-of-rocks that I'm doing wrong, but I can't find it. MVC Action: [AcceptVerbs(HttpVerbs.Post)] public virtual ActionResult Create(BatchCreateViewModel createModel) { return RedirectToRoute(MVC.Home.Display()); } BatchCreateViewModel: public class BatchCreateViewModel { bool ...

Resolve Method with Unity

Hi Friends, I'm developing an web application with asp.net mvc 2, and I'm using NHibernate (session per request) and Unity (for dependency injection). In my Global.asax I'm managing my ISession something like this: public override void Init() { base.Init(); BeginRequest += OpenNHibernateSession; EndRequest += DisposeNHiber...

Using routing with webforms - CreateInstanceFromVirtualPath sometimes very slow

I am using routing with my ASP.NET WebForms application, using the technique described by Phil Haack: http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx This works well most of the time, however on on occasion the first call to System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath is takes tens of seco...

Should I extend ASP.NET Security for a public site?

I have a ASP.NET MVC site with a private site administration application secured with ASP.NET sql-backed authorization. I need to add a login for the public site to allow visitors to sign up for an account. I am thinking I should create totally seperate storage for the public site, rather than extend the existing user db and rely on rol...

Does ASP.NET MVC 2.0 use exceptions for flow control?

Following code throws (handled) exceptions, it appears that MVC uses exceptions to test for control locations. <% Html.RenderPartial("LogOnUserControl"); %> Application works as expected, I can see that exception is thrown couple times trying different locations (Views, Shared). Same thing happens with other controls. Apparently MVC u...

Ninject syntax for "Bind" with multiple arguments

How I can use multiple parameters in Ninject syntax like following? Bind<IMyRepository>() .To<SqlMyRepository>() .WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString ); What if more than one parameter need to be passed? ...

The call is ambiguous between the following method or properties in ASP.NET MVC RenderAction

The call was working fine until I installed ASP.NET MVC 1.0 RTM. Error: CS0121: The call is ambiguous between the following methods or properties code snippet <%Html.RenderAction("ProductItemList", "Product"); %> Action Method public ActionResult ProductItemList() { return View("~/Views/Product/ProductItemList.ascx", _repository....

Mock a web service used in an action filter

I have an external-to-my-solution web service that I'm using in an ActionFilter. The action filter grabs some basic data for my MasterPage. I've gone back and forth between using an action filter and extending the base controller class, and decided the action filter was the best approach. Then I started unit testing (Yeah, yeah TDD. ...

ASP.NET MVC 2 Architecture and LINQ data model

I am creating my very first larger ASP.NET MVC application. After thinking about the application architecture for some time, I thought I would hear some other opinions. I am using LINQ-SQL for my data layer. However, I am not planning on using the LINQ objects throughout the application, since I would like some more specific data types ...

Is HttpResponse an acceptable return type for a public ASP.NET MVC Action?

I want to craft a Response and add file attachment headers, is this the way to go about doing this in ASP.NET MVC Action? Normally I return things like int, string, or more commonly ActionResult. But can I return an HttpResponse directly back to their browser like this? So if they go to /controller/action/ it would return that HTTP resp...

How do you handle Ajax calls to the controller in ASP.Net MVC

One of the beauties of MVC is the ability to use Actions for both normal web calls as well as Ajax calls. But in doing so, I'm a little uncomfortable with my code. I'd like to know what other people think. So I want to view the details of an item in a list. I have created a Details view. I also have decided to use hijaxing -- if a user ...

Returning specific UserHostAddress using TestControllerBuilder

I am using MvcContrib and the TestControllerBuilder to write tests for my controller. I am writing the tests for my Error Handling Controller that looks like this: public JsonResult HttpError() { Exception ex = null; try { ex = (Exception)HttpContext.Application[Request.UserHostAddress.ToStr...

How to add a file attachment to the Response when the file path is a URI in MVC.NET Actions?

I have a URL to a file, "http://mydomain.domain.com/files/somefile.mp3". I also have an Action in my Controller. I want the action to return the file as an attachment. I know I can do this: Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName) Response.AddHeader("Content-Length", lenOfFile) Response.ContentTyp...

jquery Validate Plugin Partial Form Validation in OnClick Function

My problem is very similar to this post: Validate subset of form using jQuery Validate Pugin, but couldn't get anything to work. I'm trying to use the jquery validation plugin to do partial form validation in an onclick js function. I have a view that has a form with many divs, each div represents a page like so: <form method="post" n...

Use mixed authentication with Asp.Net MVC (Forms, FB connect, twitter, openId)

Hi, I'm creating a new site and I want the users to be able to use several ways to sign in, basically the users should be able to create a new user on my site OR use Facebook connect OR use Twitter's account to log into the site. I have seen several tutorials on using one of these methods, what I want to know is what do you think is th...

ASP.NET MVC2 Master Page - Server side script not rendering, first bracket being escaped

I have a master page which I am using as a template to allow me to define meta tags per page. My master page takes in a model which contains the meta information, here is an example of what I am trying to do the following: <meta name="description" content="<%= Model.description %>" /> <meta name="keywords" content="<%= Model.keywords %>...

Is it better to have a method's datatype be as specific as possible or more general?

In ASP.Net MVC if I have a method on a controller that returns a View should that method be of type ViewResult or the more general ActionResult? ...

How to make ExtJs DatePicker in my MVC site ?

Hi. I need a datepicker widget via ExtJs on my pages that works like this. All I found in ExtJs are DatePicker and This sample with pickers The problem is that standart DatePicker looks like just a huge calendar with "today" button. The sample gives picker that looks like i want(textbox field and calendar on demand) but it works in ...