In my Global.asax.cs file in RegisterRoutes method, I put
routes.MapRoute("messages",
"Message/{id}",
new { controller = "Archive", action = "Message", id = 0 });
Then I created this controller:
namespace TestingApp.Controllers
{
public class ArchiveController : Controller
{
public string Message(int id)
...
What is the most preferred and easiest way to do pagination in ASP.NET MVC? I.e. what is the easiest way to break up a list into several browsable pages.
As an example lets say I get a list of elements from a database/gateway/repository like this:
public ActionResult ListMyItems()
{
List<Item> list = ItemDB.GetListOfItems();
V...
I am pretty confused about the ASP.NET MVC project architecture.
In ASP.NET WebForm I am normally for small to medium size project using following Project pattern
DAL <-- communicate through DTO/reader/dataset -- > BL <--> UI
I think in MVC application should be like
DAL <-- communicate through DTO/reader/dataset --> BL is Model <-...
Some texts on ASP.NET MVC state that "there are no runat server tags", even this MSDN article says this, when, right above that statement there is a code example with a runat server tag in the HEAD element:
http://msdn.microsoft.com/en-us/magazine/cc337884.aspx
And on StackOverflow conversations I read
"The fact that you want to...
I see that there is Controller.RedirectToAction(string actionName, string controllerName, object values) but I never got the values parameter to work. Consider I want to do the following overload of actions in a controller:
public ActionResult Read()
{
return RedirectToAction("ReadPage", "MyController", 1);
}
public ActionResult R...
I'm building a questionnaire app in asp.net mvc, and I'm having trouble with the module binder for a list of complex types.
First: I can't get Questionnaire.IList<QuestionGroup>.IList<Question> object graph to work with the binder. So in the sample code below i use only one level IList.
Second: I would love to pass in my repository/...
I'd like to extend the AuthorizeAttribute in ASP.NET MVC so that it supports the concept of a user's authorization being based on their role membership OR "ownership" of the data in question. I'm using LINQ2SQL for data access. There is a similar question at http://stackoverflow.com/questions/390930/asp-net-mvc-authorization-using-roles....
I am setting the thread culture to the culture sent via a cookie on the HttpRequest in the initialize method of a base controller I have created. I now want to create a unit test for this functionality.
In the test I have created a mock HttpContext and added the Cookie. Using this and a routeData helper, I create a RequestContext. Then ...
UPDATE - 1/21/09:
The only way I've been able to get this working moderately well is to create routes that have additional path info... in other words instead of http://company.com/myDepartment/myTeam/action/id, the routes need to be built to handle paths
like http://company.com/department/myDepartment/team/myTeam and so on.
END UPD...
I have using blocks in each method of my repository. If I want to cross reference methods, it seems it would be against best practices to initialize another Datacontext What am i doing wrong? If I declare a Datacontext in the class instead of using blocks in methods will I not lose power to dispose ??
public IList<something> GetSomethi...
I have a form which contains a whole heap of data entry fields that will be completed by the user including some elements where the user can dictate how many of the same items they will enter. This is as is being used in Phil Haack's blog entry Model Binding To A List.
I am successfully using JQuery to create the extra form elements, co...
I'm currently using session variables as a cache to cut down the calls to the database.
I'm wondering at about how many concurrent users does this stop working at? 1,000, 10,000 ....100,000??? Also will iis start flaking out at a certain load? And are there
any alternatives?
I know it depends on how much data I'm storing per user, but...
Hi,
I have an mvc application running on IIS 7.0 on windows vista.The appication is redirecting to the proper controller and action.But i am getting an error saying view is not found in the path, when the view is present at the particular path.
Route is as shown below.
routes.MapRoute(
"Default", ...
A web page displays the following:-
Bob
Fred
John
However when the user (that would be me) prints the web page I want multiple repeats of this output with slight variations to be printed on separate pages :-
Bob
Fred
John
>page break here<
Bob
Fred
John
>page break here<
Bob
Fred
John
In reality the page content is larger...
We have a web app that is using MVC Preview 3. I'm new to the project and relatively new to ASP.NET MVC itself - soon we will be looking to upgrade to either the Beta or RC version.
Are there any major difference between preview 3 and Beta version that would require extensive refactoring?
Any "gotchas"?
From my understanding the RC wil...
Does anyone know where you can find online documentation for the AJAX used in ASP.NET MVC Framework Beta? I can't seem to find it. I've been looking at the quickstarts for some information and googling for it but seems to be very difficult to find.
It seems somewhat limited as it is now. Do people use this or do it in combination with o...
Does anyone know how the validation will work with V1? I'm at the crossroads, use one of the frameworks out there or wait for V1?
My asp.net mvc development has has been put on hold until i can find out more info on the v1 release and how the validation will support both the object model and ui?? Does anyone have info?
Cheers!
...
Okay so, i am totally new to MVC and I'm trying to wrap my head around a few of the concepts. I've created a small application...
This application has a view for creating a new Individual record. The view is bound to a model ViewPage... And I have a associated IndividualController which has a New method...
The New method of the Individ...
Hi Everyone,
is there way thats i can preselect an item when the page loads or posts to the server..
this is what i have right now..
<%=Html.DropDownList("dllMonths",
new SelectList(new List<string>() {
"", "January", "Feburary", "March", "April", "June",
"July", "August", "September", "October", "November",
...
I tried implementing Phil's Areas Demo in my project http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx.
I appended the Areas/Blog structure in my existing MVC project and I get the following error in my project.
The controller name 'Home' is ambiguous between the following types:
WebMVC.Controllers.HomeController
WebMVC.Area...