I want to know the must-have helper classes to make an MVC application as decoupled as possible without being ridiculous. Below I am listing the helper classes available from the NerdDinner.com ASP.net sample application showing off MVC Framework.
ControllerHelpers.cs
FileNotFoundResult.cs
HandleErrorWithELMAHAttribute.cs
MobileCapab...
On a given page, to let's say to display a window, I may need some JavaScript initialization, some DIVs with certain IDs and it all needs to be linked with each other. The JavaScript may need to know about a DIV's ID, the DIVs may need to be nested in a certain way and so on. Obviously I don't want to worry about this on every single pag...
In this post the author recommends implementing a Wrapper for the session to ease testing and decoupling the controller code. I will like to obtain ideas on how to implement a good wrapper for this purpose.
I see that in CodeProject there is one sample but it looks way more than what I need.
EDIT 1:
Ok. Thanks to Joshua I have imp...
I am implementing a search module with result page support paging.
The example provided by NerdDinner passes pagenumber as a parameter for the Index action, and the action uses the pagenumber to perform a query each time the user hit a different page number.
My problem is that my search take many more criteria such as price, material, ...
Is it possible to clear the output cache of one asp.net web application from inside another asp.net web application?
Reason being... We have several wep applications structured like...
http://www.website.com/intranet/cms/
http://www.website.com/area1/
http://www.website.com/area2/
Pages in /area1/ and /area2/ are cached and are mana...
Hi Guys, I hope somebody can help me.
I've been trying to write a custom html helper for my MVC application. First at all, i tried with a testing one, which only writes a tag for the specified param.
The things is, it does not work unless I explicitly import the namespace.
I've been reading a lot and as i read, That method should appear...
Hi folks,
i've got a really simple POCO (business) object which I'm returning to the client as some json, using ASP.NET MVC.
eg. (please ignore the lack of error checking, etc).
public JsonAction Index()
{
Foo myFoo = MyService();
return Json(myFoo);
}
kewl. Now, this object includes following public properties...
public cl...
Hi folks,
i'm trying to send back a simple error message as Json, with the HTTP code as 404.
So i started out writing my own IExceptionFilter that checks to see the exception. To keep this simple, if the exception throw is of type ResourceNotFoundException then i set the code to 404. Otherwise everything else if 500.
Now, the problem ...
Hallo guys,
I'm using ASP.NET MVC with jquery and it's going great for now. Just, there is one question that is bothering me. How should I handle urls in jquery methods? I really wouldn't like to hard code it, like here:
$(function() {
$.getJSON("/Home/List", function(data) {
var items = "---------------------"...
Hi i have a MasterPage (ASP.Net MVC) which contains a couple of loads for Jquery ui and under that a contentplaceholder for view specific scripts:
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../../Scripts/ui.core.js" type="text/javascript"></script>
<script src="../../Scripts/ui.tabs.js" typ...
Hi
I have a Html.TextBox() and I need to make it disabled in certain conditions. With the TextArea it goes like this:
<%=primaryLang ? Html.TextArea("e.location", new { rows = 2, cols = 60 }) : Html.TextArea("e.location", new { rows = 2, cols = 60, disabled = "true" })%>
But with TextBox it is not possible:
<%=primaryLang ?
...
Hello All ,
I am developing a web application using Asp.net mvc framework with concept of sub domain for community.
I have implement concept of wild card mapping of domain like *.example.com. To test concept in vs 2008 i edited hosts file and add some sub domain like
127.0.0.1 a.localhost
127.0.0.1 b.localhost
When i request url...
I have a shared master view for all my other views. It's in this master view I show the menu. Now I need to find out in what controller I'm currently in so I can disable/enable certain menu options.
For example it should be possible to press the "foo" link if I'm current in the "foo" controller.
How Can I do this?
...
I am working on an MVC app and I am wondering in what situation it is best to use a strongly typed view and when not... I guess this is more of a best practice question. I am making an ecommerce app and there is a table for orders, products, etc. The part I was working on that brought me to this question was my add a new product page for...
What the hell does this mean. Is it because I have two different .DBML files that contain the same database table?
...
Error 343 The type 'mvc.Models.Bundle' already contains a definition for 'BundleIcon' C:\inetpub\wwwroot\Models\Assets1.designer.cs 3438 17 mvc
Error 344 The type 'mvc.Models.Bundle' already contains a definition fo...
I have a simple row that has 4 Columns { [Primary Key Int]RowID, [text]Title, [text]Text, [datetime]Date }
I would like to allow the user to edit this row on a simple page that has a form with the fields "Title" and "Text".
There is a hidden field to store the RowID.
When the user posts this form to my controller action, I want it to ...
I have an image from an Url.Action, like this
<img src="<%= Url.Action("Image") %>" alt="" />
How can I set this image as a background to a div? I tried this:
<div style="background-image:url(/Background/Image)"></div>
and others, but no success, I'm trying to play with JS over that div, and I need that background.
...
I am using the ASP.NET command
var returnValue = new JsonResult { Data = items.Skip((pageNumber - 1) * pageSize).Take(pageSize) };
return returnValue;
to return the paged contents of a table via JSON, but when I got to try to parse it, in jQuery, the $.each takes each character as an individual element.
The output from that is along...
I am trying to use the Data Annotations Model Binder Sample to provide UI validation on my application. However it seems that this doesn't work if your ViewModel contains a property that is a generic list.
Can anyone shed any light on whether this is the case?
I'm using ASP.NET MVC 1.0
...
I have to move all my scripts into a separate .js file. But I have wired the code in the client (*.aspx) file, with code such as
<script>
var x=<%=ViewData["Key"];%>
</script>
I'm sure there will be an issue when I move that line to the js file as the server side context can't be accessed.
How do I solve this issue?
...