I am in the way building some MVC Application and I really love the Data Annotations support in MVC. The build in support is good enough to enforce simple validation checkup. I wonder, how to implement unique-field validation using custom data-annotation ? For example, I have a view model that need the user to register a new login name, ...
Hi guys
I have an ASP.Net MVC app using Integrated Security that I need to be able grant open access to a specific route.
The route in question is '~/Agreements/Upload' and the config I have setup looks like this:
<configuration>
...
<location path="~/Agreements/Upload">
<system.web>
<authorization>
...
I'm trying to set up a SQL Membership Provider for an ASP.NET MVC 1.0 and I'm having problems setting up the tables and stored procedures in the database. I've tried attaching both the applications current database and a blank database to my local SQLEXPRESS instance (using SSEUtil) and then running the aspnet_regsql wizard against them...
I'm using jQuery to POST an Id to my route, for example:
http://localhost:1234/Load/Delete
with a POST Parameter Id = 1
I'm only using the default route in Global.asax.cs right now:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
When I perform the POST, ...
Just would like to know how do I disable URL Rewriting in asp.net MVC. I don't need url rewriting in my application and would like to turn it off. Reason: I am aware that url rewriting uses reflection and would like to save a few cpu cycles by avoiding it. Thanks
...
I would like to use the ajax helper to create ajax requests that send additional, dynamic data with the post (for example, get the last element with class = blogCommentDateTime and send the value of that last one to the controller which will return only blog comments after it).
I have successfully done so with the help of jQuery Form p...
Under the built in client side validation (Microsoft mvc validation in mvc 2) using data annotations, when you try to submit a form and the fields are invalid, you will get the red validation summary next to the fields and the form will not post. However, I am using jquery form plugin to intercept the submit action on that form and doing...
I'm in the process of writing a small asp.net mvc application that is using the northwind.mdf. When building the solution I get this error:
Error 1 The type or namespace name 'Order' could not be found (are you missing a using directive or an assembly reference?)
Order is a table in the northwind database.
any help is most appreciate...
If I have a drop down list as follows
<div class="editor-label">
<%= Html.DropDownListFor(model => model.CardDetail.SelectedCardSchemeId,
Model.CardDetail.CardSchemes, "Select")%>
</div>
and in my model I am using DataAnnotations
[Required(ErrorMessage = "* Required SelectedCardSchemeId Message")]
public int SelectedCardSchemeId ...
Please check below screen shot. What is main difference between Master Page and MVC View Master page.
When I should use Master page and when I should use MVC View Master page.
Thanks.
...
Hello all,
I've got a form where users can edit members of a group.
So they have the possibilty to add members or remove existing members. So the Url goes like
".../Group/Edit/4" Where 4 is the id of the group.
the view looks like this
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.Beg...
When building ASP.NET projects there is a certain amount of boilerplate, or plumbing that needs to be done, which is often identical across projects. This is especially the case with MVC and ALT.NET approaches. [I'm thinking of things such as: IoC, ORM, Solution structure (projects), Session Management, User Management, I18n etc.]
I w...
I am trying to determine whether a company has websites built with ASP.NET MVC in their portfolio. Is there a reliable way of determining that without asking them assuming that I can visit the website in question in my browser? This might seem simple, but I wasn't able to find this information online. I would think that the lack of views...
This question is related to this, hopefully better phrased.
I would like to serve a custom 404 page from ASP.NET MVC. I have the route handler and all the infrastructure set up to ensure that nonexistent routes are handled by a single action:
public ActionResult Handle404()
{
Response.StatusCode = 404;
return View("NotFound");
...
Hi, I have a MVC web application. I am calling the controller method through the getJSON() method of the jquery.
$.getJSON("applicationurl/controllerActionMethod", { parameter1: json, parameter2: jsonGrid, parameter3: value3, parameter4: value4 }, function(jsonResult) {
});
Here I am passing the json values into the parameter1 a...
Hello,
I have Ajax.BeginForm with OnSuccess & OnFailure javascript handlers.
How do fail from my controller so that OnFailure is called?
Yes, I used to call throw new HttpException(404) and it used to work.
But now, I have set a custom error handler that calls Server.ClearError(). Due to this Ajax.BeginForm thinks that no error has o...
I got pretty experienced with testing controllers, my question here is though, aren't we supposed to test the data context as well, and how ? I mean, there are a lot of relationships and constraints coming from the DB that simply testing controllers does not cover.
On the other hand, testing against the DB is not considered a good prac...
Hi
Can somebody explain me one thing.
I have two methods in my controller :
public ActionResult AddPredefinedTicket(int customerId) {...}
and
public ActionResult AddPredefinedTicket(int customerId, TicketTypes type, string additionalJsonParameters) {...} (here TicketTypes is enum)
I'm tring to make a call with using URL like
...
I have been building my first ASP.NET MVC web app. I have been using the jQuery autocomplete widget in a number of places like this:
<head>
$("#model").autocomplete({ source: '<%= Url.Action("Model", "AutoComplete") %>' });
</head>
The thing is I have this jQuery code in a number of different places through my web app. So i though...
Hi
A default value of 0 is creeping into a Surveys app I am developing, for no reason that I can see. The problem is as follows:
I have a group of Html.RadioButtons that represent the possible values a user can choose to answer a survey question (1 == Not at all, 2 == A little, 3 == A lot). I have used a tinyint datatype, that does n...