asp.net-mvc

Validate a single property with the Fluent Validation Library for .Net

Can you validate just a single property with the Fluent Validation Library, and if so how? I thought this discussion thread from January of 2009 showed me how to do it via the following syntax: validator.Validate(new Person(), x => x.Surname); Unfortunately it doesn't appear this works in the current version of the library. One other ...

Javascript to disable button residing inside a user control

Hi Team, I am using a "user control" which contains a button and other controls. I am using it in an aspx page. I want to diable the button using Javascript. By any chance, is it possible to achieve this? Thanks Lijo ...

Where does the AccountController in Asp.Net MVC 2 store its data?

I'm creating a website using ASP.NET MVC 2 and I'm thinking of using the default AccountController and Views to take care of the Users. The only problem is that, for all the rest, I'm using a Postgres database. Is there a way to link The account controller to a User class defined by me? I'm using Nhibernate to connect to the database,...

asp.net mvc xval validation

Hi there I am using xval for the first time, it seems to work fine for required fields, However I am having some issues first of all it does not seem to validate booleans and also client validation is not working for me, this is not a major issue for me, the one that I really need to work is the stringlength property. It seems to do some...

Why are users taken to /?aspxerrorpath=/UrlRouting.axd

I was just looking at analytics for an ASP.NET MVC 1 site running on Mono. I saw that once in a while users are brought to this URL: /?aspxerrorpath=/UrlRouting.axd What would cause this? ...

Convert asp.net webforms logic to asp.net MVC

I had this code in an old asp.net webforms app to take a MemoryStream and pass it as the Response showing a PDF as the response. I am now working with an asp.net MVC application and looking to do this this same thing, but how should I go about showing the MemoryStream as PDF using MVC? Here's my asp.net webforms code: private void...

Spark show logged in user

How do I show the username of the person logged in within a Spark View? The default MVC view engine had a Page object that you could get the info from. How would I do that in spark? I know that I could put the info into the viewdata dictionary, which is probably the best, but I don't want to have to write ViewData["User"] = myUser; ...

CompliationLock throws HttpException when registering areas for ASP.NET MVC unit tests

The moment I added a unit test to my ASP.NET MVC application to test some of the area routing, I got an HttpException coming out of the System.Web.Complication.CompilationLock type initializer with the following stack trace. System.Web.HttpException : The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception. ...

Class Structure w/ LINQ, Partial Classes, and Abstract Classes

I am following the Nerd Dinner tutorial as I'm learning ASP.NET MVC, and I am currently on Step 3: Building the Model. One part of this section discusses how to integrate validation and business rule logic with the model classes. All this makes perfect sense. However, in the case of this source code, the author only validates one clas...

IDENTITY_INSERT is set to off error

I have a MVC web application with a table in the model that I would like to add to. I have the primary key set along with the other data fields, but every time I try to add to the table, I get the following error: "Cannot insert explicit value for identity column in table 'TABLE_NAME' when IDENTITY_INSERT is set to OFF." I'm not sure ...

Can I assign HTML values in MVC view using Html Helpers?

is this right? i am trying to display value in input box dynamically? can anyone advice me is this corect approach? but still I am getting here only + + in input box? thanks ...

Update database using restful ASP.NET MVC 1.0

We are building an MVC 1.0 application right now and using Linq -> SQL for our DAL. Following the restful approach we have multiple action events depending on if you are updating or loading or what not. The two that I'm concerned with at this point are the edit and update action methods. Here is the signatures. public ActionResult Upda...

ASP.NET MVC Html.Display() using ViewData?

When I use Html.DisplayFor() using a property of the model, it comes out nicely with both a label for the property name and a textbox or label with the property value: Html.DisplayFor(model => model.FirstName) // renders as First Name: Joe Smith But if I try to use the same for something that is in ViewData, it doesn't seem to hav...

How do I create a simple seach box with a submit button to bring back a result set in MVC?

I am very new to MVC and just learning the basics. I have been following along in Nerd Dinner and used the demo as a way to create my own app. I have created a page that lists out some food items with calories, fat, protein,etc... (http://rjsfitness.net/CalorieList) This is one of my own personal sites that I set up to test out MVC. ...

ASP.NET MVC - Detect Time Spent on Page

Hello, Does anyone know of a way to save to capture and save the amount of time spent on a page in ASP.NET MVC? Edit To clarify a few points: Essentially the system is concerned with product placement. I am tracking the # of views of a particular product. However, to take it further I would like to see on average how long customers st...

ASP.Net MVC: Showing the same data using different layouts...

Hi guys I'm wanting to create a page that allows the users to select how they would like to view their data - i.e. summary (which supports grouping), grid (which supports grouping), table (which supports grouping), map, time line, xml, json etc. Now each layout would probably have different use a different view model, which inherit fr...

Mvc relative path using virtual directory..help!

When i drag and drop my image/script/css file into my view, relative path will automatically use to refer on the files. example: <link href="../../Content/style.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-min.js" type="text/javascript"></script> <img src="../../Images/logo.jpg" /> It is working fine ...

How to add ID property to Html.BeginForm() in asp.net mvc?

I want to validate my form using jquery but it doesn't have an ID property as of now how to add it to the form in asp.net mvc? I am using this... <% using (Html.BeginForm()) {%> and my jquery validator plugin takes this, var validator = $("#signupform").validate({ Now i want to give id as signupform... Any suggestion... ...

How to submit upon a check or uncheck of checkbox in form?

I have the following in my form <td><input id="Notifications_0__IssueCreate" name="Notifications[0].IssueCreate" type="checkbox" value="true" /><input name="Notifications[0].IssueCreate" type="hidden" value="false" /></td> <td><input id="Notifications_0__AllChanges" name="Notifications[0].AllChanges" type="checkbox" value="true"...

A suitable MVC / MOSS 2010 Architecture

We currently are running moss 2007 for an enterprise internet facing site. The site's main functionality is surfaced using FAST search with MOSS 2007 used for the cms aspects. We find that the performance and development experience inside of MOSS to have been quite painful. We are planning to migrate to MOSS 2010 but the plan is to use ...