ASP.Net MVC Ajax form with jQuery validation

Try adding an OnBegin callback to the AjaxOptions and return the value of $(‘form’).validate().form() from the callback. Looking at the source it appears that this should work. function ajaxValidate() { return $(‘form’).validate().form(); } <% using (Ajax.BeginForm(“Post”, new AjaxOptions { UpdateTargetId = “GBPostList”, InsertionMode = InsertionMode.InsertBefore, OnBegin = “ajaxValidate”, OnSuccess = “getGbPostSuccess”, OnFailure = “showFaliure” })) … Read more

Why is ListBoxFor not selecting items, but ListBox is?

I’ve stumbled across this problem myself, finally I realized that the problem was a naming convention. You cannot name the ViewBag or ViewData poperty containing the SelectList or MultiSelectList to the same name your property model containing the selected items. At least not if you’re using the ListBoxFor or DropDownListFor helper. Here’s an example: public … Read more

PDF files do not open in Internet Explorer with Adobe Reader 10.0 – users get an empty gray screen. How can I fix this for my users?

It’s been 4 months since asking this question, and I still haven’t found a good solution. However, I did find a decent workaround, which I will share in case others have the same issue. I will try to update this answer, too, if I make further progress. First of all, my research has shown that … Read more

Accessing UserManager outside AccountController

If you’re using the default project template, the UserManager gets created the following way: In the Startup.Auth.cs file, there’s a line like this: app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); that makes OWIN pipeline instantiate an instance of ApplicationUserManager each time a request arrives at the server. You can get that instance from OWIN pipeline using the following code inside a … Read more

How do you trigger the “error” callback in a jQuery AJAX call using ASP.NET MVC?

NOTE: Hey, this was posted before ASP.Net MVC even hit 1.0, and I haven’t even looked at the framework since then. You should probably stop upvoting this. Do something like this: Response.StatusCode = (int)HttpStatusCode.BadRequest; actionResult = this.Content(“Error message here”); The status code should change depending on the nature of the error; generally, 4xx for user-generated … Read more

Error “More than one matching bindings are available” when using Ninject.Web.Mvc 2.0 and ASP.NET MVC 1.0

I finally figured this issue out recently. Apparently, the NinjectHttpApplication.RegisterAllControllersIn() function doesn’t do all of the proper bindings needed. It binds your concrete controller implementations to IController requests. For example, if you have a controller class called SampleMvcController, which inherits from System.Web.Mvc.Controller. It would do the following named binding during application start: kernel.Bind<IController>().To(SampleMvcController).InTransientScope().Named(“SampleMvc”); But when … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)