Hi,
I'm using ASP.NET MVC 1.0 and have exeption handling manged by a global controller activated by the HandleException attribute on the main controller.
I've noticed that if I have an action invoked by an AJAX call, and that action fails with an internal ASP.NET error (e.g. I've tried to serialize an anonymous object) then the ASP.MVC...
Is it possible to Multiple Objects Using ASP.NET MVC'S JsonResult Class.... Here is a controller method which returns json object of my records but i also want to pass the count value....
var materials = consRepository.FindAllMaterials().AsQueryable();
var count = materials.Count();
var results = new PagedList<MaterialsObj>(materials, c...
My code is the following
public class SessionCheckAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (/*condition*/)
{
filterContext.HttpContext.Response.Redirect("http://www.someurl.com",true);
}
base.OnActionExecuti...
I have a stored procedure that returns a result set (4 columns x n Rows). The data is based on multiple tables within my database and provides a summary for each department within a corporate. Here is sample:
usp_GetDepartmentSummary
DeptName EmployeeCount Male Female
HR 12 5 7
etc...
...
Hello,
I use LINQ queries in my ASP.NET MVC application and want to use OutputCache in some of my Actions.
I hear this should be possible with CommandNotifications. But those seem to only go for self-created SQLCommands, or am I wrong?
Can I manually tell SQL server to send SQLDependency notifications if certain tables change? And if...
I'm trying to update my project to ASP.Net MVC 2.0 from MVC 1.0. I've removed the references for System.Web.MVC to the newer versions. I'm getting an exception from the HTTPContext which reads "CurrentNotification = 'HttpContext.Current.CurrentNotification' threw an exception of type 'System.PlatformNotSupportedException'". What other...
i have my auto-generated linq to sql classes, and i extend this class using partial classing (instead of using inheritance), and i have properties that that i've put in later which are not part of the database model and should not be. these are things like "FinalPrice" and "DisplayFinalPrice" - in the dbase, there is only RetailPrice and...
I've found a pattern in my Views like this:
<% if (someCondition)
{
Response.Write(string.Format("Foo {0}, Bar {1} Baz {2}.", userName, someCounter, someDate)); }
else
{
Response.Write(string.Format("Foo is {0}.", bar));
}
%>
The basic pattern of if...else with a bunch of repeated Response.Write(string.Forma...
I ask this because i'm using Partial classing to extend my db model, and in doing so some snags i've run into using inheritance and also snags i've run into declaring my db model in another class as a property and just using it like that ie: Public Property DBModelClass as DBModelClassType - however, doign direct partial classing has wo...
Hello,
I was wondering what the best way is to replace the genericPrincipal with my own CustomGenericPrincipal.
At the moment I have something like this but I aint sure if it's correct.
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCook...
I had an MVC 1.0 web application that was in VS 2008; I just upgraded the project to VS 2010 which automatically upgraded MVC to 2.0.
I have a bunch of viewpages have codebehind files that were manually added. The project worked fine before the upgrade, but now the onclick even't don't get triggered.
I.e. I have an asp:button with an ...
I'd like to set the default content-type for web pages in my ASP.NET MVC application to text/html.
I know this can be done by adding a ContentType="text/html" to all of my <%Page%> elements, but I'd prefer to use the web.config instead. How can I do that?
Thanks,
Adrian
Edit: I know that "text/HTML" is the ASP.NET default, but for u...
I have an ASP.NET MVC site that uses both Microsoft Ajax [Ajax.BeginForm()] and jQuery to make asynchronous requests. I want to configure both frameworks such that a generic error handler is automatically attached if the developer does not explicitly specify a failure callback.
In jQuery I can accomplish this with either .ajaxSetup() or...
Hi
I am using asp.net mvc 1.0 and I want to return a XML file but I also want to return a strongly typed data back so I can update some fields.
Like the XML file will contain users who failed to be inserted into the database. So I want that to appear as a dialog save box what asp.net mvc return file() would do.
However I also want to ...
I'm currently reading Pro ASP.NET MVC Framework by Sanderson. In the book he recommends setting up IoC using Castle Windsor, and he points out that the download automatically installs it and registers the Castle DLLs in the GAC. Well, at this point in time (5/4/2010), the Castle Project no longer has a downloadable installer that sets ...
I want to override Html.TextBoxFor() with my own helper that has the exact same signature (but a different namespace of course) - is this possible, and if so, how?
The reason for this is that I have 100+ views in an already existing app, and I want to change the behaviour of TextBoxFor so that it outputs a maxLength=n attribute if the p...
hi guys,
i'm just learning to put in unit testing for my asp.net mvc when i came to learn about the mock and the different frameworks there is out there now.
after checking SO, i found that MOQ seems to be the easiest to pick up.
as of now i'm stuck trying to mock the Request.ServerVariables, as after reading this post, i've learned th...
I'm logging all errors occuring in my OnException method.
How to find in which controller/action an error occurred?
...
I am using jquery with asp.net mvc.... Is my data option valid or am i missing some thing...
$.ajax({
type:"POST",
url: "Materials/GetRecords",
data: "{'currentPage':1,'pageSize':5}",
Any suggestion....
EDIT:
I am calling a function from a view page,
<asp:Content ID="Content2" ContentPlaceHolderI...
where does mvc stores the association between action method name and view page name? or who is responsible for checking if the there is a view page with name same as action method name?
...