asp.net-mvc

C# ASP.NET MVC 2: HTML.ListBox doesn't work

Hi, I want to create a listBox: http://blog.wekeroad.com/blog/aspnet-mvc-preview-using-the-mvc-ui-helpers/ The Html.ListBox doesn't work: <div class="editor-field"> <% string[] movies = new string [] { "a", "b", "c" }; %> <%: Html.ListBox("lala", movies, new string[] { "b" })%> </div> I get the following errors: ...

How to handle tab page as a controllers per tab

I have the following markup inside a master page <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-1.4.1.min.j...

ASP.NET Mvc absolute url with an application inside a website

Hello everyone, I have 1 website on IIS ("myWebsite") and another inside this one ("secondWebsite") as an application. Both are ASP.NET Mvc websites. I have a method who works perfectly on the first one : public static string AbsolutePath(this UrlHelper url, string path) { Uri requestUrl = url.RequestContext.HttpContext.Re...

ASP.NET MVC - How to make it work with IIS6

I am having some issues with deploying my MVC 2 application on a IIS 6 server. I have the following project structure: / App/ Controllers/ Helpers/ Infrastructure/ Models/ Views/ Public/ # This folder contains CSS and JS files Global.asax Web.config I have a custom System.Web.Mvc.We...

How to get rid of that HTML error report in ASP.NET MVC ?

All I need would be just the error message in plain text. But ASP.NET is doing some HTML report output from every error. I have a jquery ajax call and when an error is thrown I'm getting all that crap over to the client side. I've created a filter attribute but didn't helped. public class ClientErrorHandler : FilterAttribute, IExcepti...

MVC DDD: Is it OK to use repositories together with services in the controller ?

most of the time in the service code I would have something like this: public SomeService : ISomeService { ISomeRepository someRepository; public Do(int id) { someRepository.Do(id); } } so it's kinda redundant so I started to use the repositories directly in the controller is this ok ? is there some architect...

jQuery is not functional on Mozilla Firefox

I have problem with my ASP.NET MVC app when use Mozilla Firefox. I'm use JQuery and this code is not functional. In Google Chrome and IE 8 everything is fine. How solve this. If necessary I will post parts of my JQuerycode In Site master page I include scripts, something like this: <script type="text/javascript" src="../../Scripts/jq...

how to set width of html.textboxfor?

Hello all, I have a <%= Html.TextBoxFor(user => user.Name) %> and it has standart width. What schould i do to make textbox widther? Thanks and take care, Ragims ...

Having the Model in a separate project

I'm new to MVC and I'm wondering if there could be any issue if I don't use the "Models" folder that the guidance created for me, but I use a separate Class Library project for the models. From my perspective it should work, and I don't need to do anything else than adding the project since I already have it from a desktop app I made in...

RouteLink problem

My routes are www.xxxxxxx.com/taxes/us/all-states/all-taxes/2010/q1 and www.xxxxxxx.com/taxes/us/alsalka/all-taxes/ routes.MapRoute( "TaxReport", // Route name "taxes/us/{state}/{taxType}/{year}/{quarter}", // URL with parameters new { controller = "TaxViewer", ...

ASP.NET MVC 2: "The process cannot access the file <filename> because it is being used by another process."

I'm trying to use Controller.File to return a FilePathResult from a view in my ASP.NET MVC 2 project. I use it like this: return File(pdfFilePath, "application/pdf", "foo.pdf"); However I keep getting this error in the yellow screen of death: The process cannot access the file [the file path] because it is being used by another proce...

ASP.NET MVC: Is it possible to send error data to a non-POST page?

Since POST request is separate, I have to do all the stuff I already did in a GET request again. So is it possible to redirect to the same page, but as a GET request? I know it's kinda confusing... [HttpPost] public ActionResult Foo(...) { ... return View("Foo", modelWithErrorsData); // Returns POST, I need GET } ...

ASP.MVC handle errors

In ASP.NET Web Forms,i would accomplish that easily: [...] try { DateTime date = Convert.ToDateTime("abc"); } catch(Exception ex) { lblErrorMessage.Text = ex.Message; } Now the question is:How can i do the same in ASP.NET MVC? Ive been looking for it and all i found is [HandleError] attribute.I dont want to redirect user to a "...

Correct external javascript-per-view file placement in an ASP .NET MVC Application

In an ASP .NET MVC application, what's the correct folder to place external javascript files particular to each view? Most views require javascript code that I'm planning to write in external files, but I'm not sure if I should drop them next to the views or in subfolders of the Scripts folder. ...

ASP.NET MVC LINQtoSQL

I have an entity with a child. How can I display a count of the children for each object in my view? I've tried: <% foreach (var item in Model) { %> <%: item.JobTitle %> <%: item.EmploymentApps.Count %> Applications <% } %> but I'm getting a runtime error: Compiler Error Message: CS0012: The type 'System.Data.Linq.EntitySet`...

ASP.NET MVC Edit problem - "entity" data from controller aren't passed to the view

Hi, I'm pretty sure that I complicated my question. Sorry, I didn't know how to express myself. Situation is next : public ActionResult Edit(int id) { CreateTrainingModel editTrainingModel = new CreateTrainingModel(); editTrainingModel.Training = training.GetByID(id); editTrainingModel.Player = player.GetAll...

code behinde file. does it make any sense in asp.net mvc?

Hello all, I have an asp.net mvc project, its build just from views, controllers, models, and other files. I have any codebehind file in my views. Does it makes sense to create them for using sometime? Is it some situation when they giving more abilities and advantage for developer? Thanks and take care, Ragims ...

create wizard form in MVC and how to manage view and controller folders

Hi everyone, i need to make a form wizard of 3 steps. Each steps can be saved in the database separatly. The steps will be to enter information about an Company, then his Publications and finally his Reservations. Should i put all the logics in one controller or different controllers? My first thought would be in one controller since t...

ASP.NET MVC Problem with Html.ListBoxFor()

I'm having problems with the helper Html.ListBoxFor(). Here is my ViewModel: public class NewReservation { public SelectList AvailableServiceDates { get; set; } public DateTime SelectedServiceDate { get; set; } } Here is my action method: public virtual ActionResult New() { NewReservation newReservation = new...

Autofac in ASP.Net MVC

As a newbie to Autofac, I'm trying to figure out how to register my Repository for my Controllers. The Repository takes a web service in its constructor to communicate with the server. This application is multi-tenant and the tenant name is accessed in the MVC route data. Since I can't access the route data within global.asax like most...