After going through some tutorials on asp.net mvc the repository pattern came up and the example was with one table, the dinners table. Basically the set up was to create an interface and then a concrete class which implemented the interface and program off the interface in the controller class. The Interface has your typical crud method...
Is there a way to direct specific errors to specific error pages or views (e.g. Error404.aspx) through MVC?
...
I currently have the following routines in my Global.asax.cs file:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Arrangemen...
On an ASP.NET MVC View, I have a couple of checkboxes, one for email address and one for phone. I want to make sure that at least one is checked (both can be checked, so a radio button is not ideal) and if neither are, highlight the row with a red border just like a textbox is with the validation functionality...
I have other fields th...
I have a grid (foreach in view) which is shown based on a GET request.
For the POST request, I want to return a filtered view of the grid. The grid is already a partial view, so just returning the grid is no problem.
However, I am looking for some sample code on how I get my filter conditions (there are quite a few, I would have those ...
I'm currently about two-and-a-half weeks in to my first ASP.Net MVC application, and so far, I love it.
This current project is a port of an ASP.Net WebForms project, and I am trying to maintain functionalty. All is going well.
However, I find myself repeating... myself.
For example, In my BaseController class, in my BaseViewPage, in...
I've got a simple form in an MVC app I've made. It contains a file field so users can upload an image. It all works great.
Problem is, if the form submit fails validation the content of the file field is lost (other fields remain populated, thx HtmlHelpers!). How do I keep the file field populated after a failed validation?
TIA!
...
I finishing up a web application and I'm trying to implement some logging. I've never seen any good examples of what to log. Is it just exceptions? Are there other things I should be logging? What type of information do you find useful for finding and fixing bugs.
Looking for some specific guidance and best practices.
Thanks
Follow up...
I have an app I must write that will utilize a database for each company we are able to get as a client.
Unfortunately, the schemas for all the companies databases's are not identical, even though for this app they all have the basic information I need (even if their column names are different/in a different table).
My solution to ha...
I'm developing a web application using ASP.NET MVC and I'm using Windsor Castle as an IoC container (both WindsorControllerFactory and for my internal components). Currently I'm creating and storing the container into the Application (HttpApplicationState) like this:
protected void Application_Start()
{
...
IWind...
Hi,
I have a page routed like /Comments/Search/3 where i search and display all the comments of the thread "3".
I'm adding a sort function (by date, author etc). What is the best way to handle it? /Comments/Search/3/Sort/Author or /Comments/Search/3?sort=author ?
How do I automatically handle the querystring sort=author as a parameter ...
Hi all
I am getting the following runtime error in my ASP.Net MVC application:
NHibernate.MappingException: No persister for: MyProject.Model.MyDomainObject
I am referencing the burrow and fluent binaries in my application and am reconfiguring burrow in Global.asax on Application_Start as follows:
var bf = new BurrowFramework();
IFr...
I've downloaded and installed the latest ASP.Net MVC framework, and installed the Subsonic project template. The template understandably comes installed with support for MS-SQL server only, and I'm wondering if anyone has created version of the .tt template files to cater for a MySql connection?
I've added the MySql connection string to...
I'd like to know what the scope and visibility of TempData is in ASP.NET MVC.
...
I want to write a unit test to ensure that the view I am returning is the correct one.
My plan is to write a test that first invokes the controller and then calls the ActionResult method I plan to test
I thought I could write something like
Controller controller = new HomeController();
var actionresult = controller.Index();
Assert.Fals...
I have an issue while submitting data using Jquery. When i submit the form the page is getting refreshed instead of updating div. Following is my code
<% using (Ajax.BeginForm("getAjaxTab2", new AjaxOptions
{
UpdateTargetId = "tabs-1",
InsertionMode = InsertionMode.Replace,
OnSuc...
Hi, I have a problem with transfer of my project to iis server. At the asp.net development server all routing went smoothly. Now i want to migrate to iis server and my onchange attribute on select tag doesnt work. When i try to get from https://www.web.com/Manager/Authorized/Accounts/0 using the
onchange="location.href='<%= Manager.MyCo...
I am having the standard issue timeout exception in my production environment whereby, after 90 seconds, the thread will be killed. For the vast majority of my site this isn't a problem.
However, my sitemap generator is an exception to the rule.
Because it relies on the routes created in the application, I have chosen to create it ins...
I have a controller in C# using the ASP.Net MVC framework
public class HomeController:Controller{
public ActionResult Index()
{
if (Request.IsAjaxRequest())
{
//do some ajaxy stuff
}
return View("Index");
}
}
I got some tips on mocking and was hoping to test the code with the following ...
I'm reading up on ASP .NET MVC, and I just got to a section talking about the Authorize attribute. It's saying that the Authorize attribute is used to check that a user is authenticated against a Controller. Is this true? I know that the attribute is designed to be used for authorization purposes, but is it also a best practice to use...