asp.net-mvc

Can I make one row show at a time in a table?

I have a javascript function that toggles the display for rows in a table. The dilemma is that I would like to display one row at a time. What is a neat way to do this? function optionSelected() { var optionSelect = document.getElementById('ddlSelect'); var strTest = optionSelect.options[optionSelect.selectedIndex]...

Workflow for Creating Project and User Records in ASP.NET MVC Application

I have an application which has a Projects table and a Users table. In my Create New Project form I have a required field for Project Manager. However, the User record for Project Manager may not exist yet. Project Manager is a required field. Up to now I have been developing the application on a "one screen, one record" basis, but t...

Injecting an IPrincipal with Unity Property Injection at runtime

Using Unity in an ASP.Net MVC 2 app I have various dependencies on Controllers instantiated correctly. However, I want to ensure that the current IPrincipal for the user is going to be passed via injection to lower level Services, Repository etc. Therefore in a lower level service I have something like: [Dependency] IPrincipal Current...

Routing *Path wildcard will not accept Path when only one slash

I have a problem with the wildcard route that I wonder if anyone can help on, I have a route as below routes.MapRoute( "ReportRoute", "Report/{*path}", new { controller = "Home", action = "Index"}) .RouteHandler = new ReportPathRouteHandler(); where the routehandler splits the path int...

Looking for repeater type functionality in ASP.Net MVC

I am used to using a Repeater control in conventional ASP.Net web projects. I see ASP.Net MVC doesn't have this sort of thing. What should I be using here? EDIT: In response to the question, what am I trying to do that I can't achieve in the foreach. I guess I am trying to get a alternating row style. Also, it just feels somewhat wrong...

New Presentation Layer for Webapplication

Hi, we've got an existing webapplication written in magic. But now we eventually want to exchange the existing web-presentation layer (maybe also rich client) to a server side presentation layer. What do you think I should look first (ASP.Net MVC, Silverlight, something in PHP). With which technology is the effort relativly small to ex...

MVC 2 and Entity Framework - Should I put Entity classed in seperate layer?

I'm looking at ASP.NET MVC 2 and Entity Framework for a project I'm beginning. Whilst I previously used .NET lots up until around the time 3.5 had just come out, I've not really been so inspired to keep up over the last few years, so am a bit out of the loop. Anyway - I'm trying to find some information on preferred solution setup when ...

How can I loop through table rows to toggle the display style?

I would like to toggle the display row for a table in javascript. How do I do this? <script type="text/javascript" language="javascript"> function vehicleSelected() { var autoSelect = document.getElementById('vehicleSelect'); var strAuto = autoSelect.options[autoSelect.selectedIndex].value; ...

ASP MVC - Getting Controller Level error handling

How to get Controller-Level error handling: This is my map-route: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); And I have...

Following NerdDinner tutorial, don't allow duplicate

My sql database doesn't allow 2 records to be added with the same number. If I try to create a record with a previously used number or edit a record to use a previously used number, it doesn't allow it and returns to the edit/create page with an asterisk by the subcontract number field. I would like to add a Rule Violation for this so ...

UpdateModel() causing row(s) to not be updated

Hello all, I'm having a problem using UpdateModel(theModelToUpdate) causing concurrency issues. Basically whats happening is, there is a row in the database that contains most but not all the information needed for that row. The rest of the needed information is NULL. The user (using a listbox) would then add information to this row, a...

ASP.NET MVC: How to create a usable UrlHelper instance?

I am using quartz.net to schedule regular events within asp.net mvc application. The scheduled job should call a service layer script that requires a UrlHelper instance (for creating Urls based on correct routes (via urlHelper.Action(..)) contained in emails that will be sent by the service). I do not want to hardcode the links into th...

jquery .ajax request blocked by long running .ajax request

I am trying to use jQuery's .ajax functionality to make a progress bar. A request is submited via .ajax, which starts a long running process. Once submited another .ajax request is called on an interval which checks the progress of this process. Then a progress meter is updated using this information. However, the progress .ajax call o...

'Global' state and ASP.NET MVC

I am playing with learning ASP.NET MVC as a non-web developer. I am trying to find the best idiom to use for an app that has a concept of selecting a 'project' to work on the first page that affects all other pages. There seems to be three choices: Just put the information into the session state. Works fine, but isn't very MVC-ish E...

after return PartialView() Url.Actionlink("Action", "Controller"), the Controller is lost

Well the Question is related to a problem I posted before (http://stackoverflow.com/questions/2403899/asp-net-mvc-partial-view-does-not-call-my-action). In practice I've a partial view which contains a Form, after submitting the Form the Controller returns the Partial View. Well the Problem is if I reload the page which contains the par...

Using Generics to Create HtmlHelper Extension Methods

Hi Guys I'm not really familiar with creating generic methods, so I thought I'd put this question to the community & see what comes back. It might not even be a valid use of generics! I'd like to create a HtmlHelper extension method where I can specify that the method is of a certain type. I pass into the method an instance of that typ...

ASP.net MVC on IIS 7 returning blank page

I'm having some trouble deploying an ASP.net MVC 2 RC 2 application to my production box. I have it working well in both dev and test. The key difference seems to be that the production box has not yet been upgraded to IIS 7.5. When I go to the site I just get a blank page as is described in http://stackoverflow.com/questions/557730/i...

MVC2: Validating User Input / Best Practices

I'm trying to validate user input, in particular user passwords. I have some jQuery validation, but of course I also need to validate on the server side. Now my request comes in to the controller, which will hand it off to a UserService. Everything is loosely coupled, so the controller really doesn't know too much about the inner UserSer...

Linq to Sql DB Object to Domain Object mapping and performance

I'm having a problem trying to make my LINQ to SQL queries and the mapping to my domain objects DRY without incurring the cost of multiple round trips to the db. Given this example: var query1 = from x in db.DBProducts select new MyProduct { Id = x.ProductId, Name = x.ProductName, ...

how to expand the subgrid in asp.net mvc

hello friends. I have a gridview data and this gridview have subgrid too. in the first column of the grid view having + symbol so that i can expand the grid to see subgrid.. but now problem is I need to have a button in the bottom of the grid to expand all the gridview subgrid at a time.. Thanks ...