asp.net-mvc

Validationattribute only when value is changed?

I want to write a custom ValidationAttribute that checks if the given value is unique or not. The problem is that in the edit screen, it is not guaranteed that the user actually changed the value, resulting in a false error. Is there a way to check in my attribute whether the value actually changed? Or can I trigger the attribute onl...

asp.net mvc deployment

Ive managed to get asp.net mvc up and running on an iis6 server, but I keep getting silly messages like 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' I've got all the required dlls and even installed mvc from http://www.microsoft.com/downloads/details.aspx?FamilyID=c9ba1fe1-3ba8-439a-9e21-def90a8615a9&...

LINQ to SQL - Grouping categories by parentId

I am trying to construct a navigation menu using a Categories table from my db. I have a similar layout as below in Categories table. public List<Category> CategoryData = new List(new Category[] { new Category{ CategoryId = 1, Name = "Fruit", ParentCategoryId = null}, ...

selected value for dropdownbox in asp.net mvc using selectlist

hi, i have following selectlist for dropdownbox in aspnet mvc. This is the editEmployee Action controller, so while edit page is displayed i want to display a selectvalue in dropdownbox,since "SelectList" takes 3 parameters one for value,one for text and other is for selected value, here i'm not getting what should i pass in 3rd paramet...

How to check the correct radio button.

I have a Table containing some information that I need. All these rows also contains a column with a radio button in it so that the user is suppose to be able to check one of the rows as default. When I'm bringing the data back from the DB and want to select the one that's currentlly the default one. <% foreach (var item in (IEnumerab...

How to send XML file to client in ASP.NET MVC

In an ASP.NET MVC I have a database table. I want to have a button on some view page, if some user clicks that button I my application will generate XML file containing all rows in the database. Then the file containing XML should be sent to the client so that the user will see a download pop-up window. Similarly I want to allow user to...

ASP.net MVC - Update Model on complex models

Hi there, I'm struggling myself trying to get the contents of a form which is a complex model and then update the model with that complex model. My account model has many individuals [AcceptVerbs(HttpVerbs.Post)] public ActionResult OpenAnAccount(string area,[Bind(Exclude = "Id")]Account account, [Bind(Prefix="Account.Individuals")] En...

class diagram from aspnet MVC Application

hi,i have problem in making class diagram for asp.net mvc. since in mvc application i have model classes and controller classes, so m confused that class diagram should include model classes ...

Loop to LINQ Conversion -

Ok I have the following, set-up and working great. These lines of code should do a conversion from DAL Entity (Subsonic) to a ViewModel. IList<ProductOptionModel> OptionsRetData = new List<ProductOptionModel>(); foreach (var CurProductOption in this.ProductOptions) { OptionsRetData.Add(CurProductOption.ToDataModel(...

Mvc viewpages and custom data for all pages.

Hi, I need some data to be available on all the viewpages inside the website. The data comes from an parameter supplied to all the routes, i want to get that param and get the according data for it and make it available for all the views (including the master pages). It would be nice if it could be done in one place. What do i need to...

Webforms Vs Asp.Net MVC VS2010 LoadTest

A colleague of mine ran a simple load test using VS2010 on a Webforms project and an Asp.net MVC project and noticed that Webforms was serving around 83 requests per second whereas Asp.net MVC was serving 28 requests per second. Both the sites were published on the same server with similar settings. Webforms project had 10 pages 5 of th...

deploying aspnet mvc application to localserver iis6 in XP-sp3

This is Where i found the article for deploying aspnet mvc to localserver hello friends this is the process i found to deploy aspnet mvc application on iis6 but i am not getting insert option under wildcard application. suppose if i edit bydefault entry for "Executable" i.e C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll ...

Html encoding in MVC input

I'm working through NerdDinner and I'm a bit confused about the following section... First they've added a form for creating a new dinner, with a bunch of textboxes delcared like: <%= Html.TextArea("Description") %> They then show two ways of binding form input to the model: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create() ...

How can I test route/action resolution of URL with query string?

I'm trying to use code such as the following in my unit tests, /* Test setup code */ _routes = RouteTable.Routes; MvcApplication.RegisterRoutes(_routes); //set up the routes as they would be in actual application /* test code */ Expression<Func<SearchController, ActionResult>> actionFunc; actionFunc = action => action.Results("x", 3, nu...

How can i supply an AntiForgeryToken when posting JSON data using $.ajax ?

I am using the code as below of this post: First i will an fill array variable with the correct values for the controller action. Using the code below i think it should be very straigtforward by just adding the following line to the javascript: data["__RequestVerificationToken"] = $('[name=__RequestVerificationToken]').val(); The <%=...

Sending xml to an ASP.NET MVC Action Method Argument

Is it possible to send POX (plain old xml) into an action and have that action perform model binding to an object for you. Have seen this done with JSON but dont see anyone doing this with xml. ...

Is file upload control is available in html helper class in asp.net mvc

Is file upload control is available in html helper class in asp.net mvc if not then how should we use file upload control ...

Asp.net mvc inheritance controllers

Hi, I'm studing asp.net mvc and in my test project I have some problems with inheritance: In my model I use inheritanse in few entities: public class Employee:Entity { /* few public properties */ } It is the base class. And descendants: public class RecruitmentOfficeEmployee: Employee { public virtual Rec...

ASP.NET Load unmanaged dll from bin folder

Question: I use an embedded Firebird database in ASP.NET. Now, Firebird has a .NET wrapper around native dlls. The problem is, with the .NET compilation and execution process, the dlls get shadow copied to a temporary folder. Unfortunately, only the .NET dlls, and not the native dll. See http://msdn.microsoft.com/en-us/library/ms36672...

What is the best way to store static data in C# that will never change

I have a class that stores data in asp.net c# application that never changes. I really don't want to put this data in the database - I would like it to stay in the application. Here is my way to store data in the application: public class PostVoteTypeFunctions { private List<PostVoteType> postVotes = new List<PostVoteType>(); pu...