Hello guys. I'm having some troubles with SelectList in ASP.MVC.
Here is the issue: I have a Create View and begind a ViewModel model.
The page load just fine (GET verb). But when posting, something happens, and my model is considered invalid, and it cannot insert. Here's what i've tried so far.
public class DefinitionFormViewModel
{
...
I'm using TempDate["Message"] to show little update banners as the user does things on my site like this:
[AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "Admins")]
public ActionResult Delete(int id)
{
_Repo.DeletePage(id); // soft-delete
TempData["Message"] = "Page deleted!";
return RedirectToAction("Revisions", "Page", ne...
A short while ago I'm sure I read that is was possible to use AutoMapper to map the validation attributes from the domain model to the view model, i can't find that post any more though!
Has anybody seen any code or know if it would be possible to do this? This would give the added benefit of not repeating validation in both ViewModel +...
I've been in some discussion recently about where email (notifications, etc...) should be sent in an ASP.NET MVC application. My nemesis grin argues that it only makes sense that the email should be sent from the controller.
I argue that an email is simply an alternate or augmented view through a different channel. Much like I would dow...
I have an ASP.Net questionnaire application that resubmits data to the same page, showing a different question each time. There are BACK and NEXT buttons to navigate between questions.
I would like to detect when the form is submitted due to a browser refresh vs. one of the buttons being pressed. I came across a WebForms approach but ...
Hey
I'm starting to get really worried about the Sql membership that is setup with ASP.NET MVC.
I have made no changes to the defaults but out of 4000 registrations on our site 18 of these are missing corresponding data in the aspnet_membership table, there is only data in the aspnet_users table.
Looking at the stored procedure to c...
Hi
I’m trying to do some validation in asp .net MVC 2.0 for my application. I want to have some nice client side validation. Validation should be done most time on model side with DataAnnotations with custom attributes( like CompareTo, StringLenght, MinPasswordLenght (from Membership.MinimumumpassworkdLenght value).
For that purpose I t...
hi all, i have several AreaRegistration classes which one each registers own routes and each one have some duplicated elements such as bolded text in below:
context.MapRoute("Search", "**{culture}/{style}**/search",
new
{
**culture = cultureValue,
...
This is a really strange behavior, and I've set up some demo code to try to figure out what's going on.
Basically have a a two actions and a single view. The first action sends an empty model to the view, the section action recieves the model, alters its contents and sends it back to the same view.
The wierdness is, in the view, the Mo...
I am new to ASP.NET Development and can't decide between developing with Webforms or MVC 2. Nevermind the pros and cons of each. I've seen mixed opinions of each. But which method would be the best for someone who has no prior experience in ASP.NET or C#?
If your answer is: learn both, then which should I learn first? MVC 2 or Webforms?...
Short verion: need ViewUserControl (i.e., Login Form) to post to self and be able to redirect (i.e., on successful login), or return original View (i.e., Home/Index) with validation summary and not interfere with other ViewUserControls on the page.
Also, HomeController/Index should have minimal knowledge of Login Form's inner workings. ...
Although Enable Edit and Continue is checked on the Web tab of my ASP.Net MVC 2 project, I cannot in fact change the source code while running. For example, if I try to edit a controller while paused in the debugger, I cannot change the file (acts as if read only).
I found a related post Edit and continue in ASP.NET web projects, howev...
I've been trying to create a controller in my project for delivering what could turn out to be quite complex reports. As a result they can take a relatively long time and a progress bar would certainly help users to know that things are progressing. The report will be kicked off via an AJAX request, with the idea being that periodic JSON...
I got one problem with showing error message to element.
Is there any option to turn on messages on place where is Html.ValidationMessageFor(model => model.ConfirmPassword). Becsoue for me it isn’t show up. I would like to have summary and near field information too not only red border. Any one know how to do it?
using (Ajax.BeginForm...
I have just started using the AsyncController in my project to take care of some long-running reports. Seemed ideal at the time since I could kick off the report and then perform a few other actions while waiting for it to come back and populate elements on the screen.
My controller looks a bit like this. I tried to use a thread to perf...
In my javascript file I'm getting the content of a partial with the following call:
$.ajax({
type: "GET",
url: value.href.replace(actionType, actionType + 'Partial'),
dataType: "html",
success: function(result) {
$("#DepartmentsAction").html(result);
alert(result);
}
});
Because the partial has the call Html.EnableCl...
Hey everyone
I'm just getting started with Dependency Injection (DI) using Ninject and am working through my controllers looking to decouple them from my models a bit more.
At the moment, inside of my controllers I am creating an instance of some given model e.g:
var activitiesModel = new ActivitiesModel();
For each of my models tha...
Hey everyone,
I have an ASP.NET MVC 2 project that I'm working on and I'm wondering where I should place some of my code.
I currently have a UsersModel which consists of a bunch of static methods that operate against my data context.
These methods include such things as: UserExistsInDatabase, UserIsRegisteredForActivity, GetUserIdFrom...
Hey everyone,
I'm on a roll today with questions.
I'm starting out with Dependency Injection and am having some trouble injecting a dependency into a base class.
I have a BaseController controller which my other controllers inherit from. Inside of this base controller I do a number of checks such as determining if the user has the rig...
How would one go about detecting a page refresh / F5 key push on the controller handling the postback? I need to distinguish between the user pressing one of two buttons (e.g., Next, Previous) and when the F5 / page refresh occurs.
My scenario is a single wizard page that has different content shown between each invocation of the user ...