asp.net-mvc

Is there a way to preserve Dropdown list valuses

I have the classic scenario when a form is rendered from an action method returning a view. The view contains some dropdown lists that are prefilled (like calling some repository methods) before the view is rendered and a DTO is passed to the view. When the form is posted I would like to re-render the same view without getting again ...

Best solution for administration in ASP.NET?

Hi all! I am going to make an web application where a lot of users are going to input data into a SQL Server with ASP.NET 3.5. There will be no heavy load of data sent to the client as data will be set to pagesized from the database. Stored procedures are used. I am asking you guys with experience in web 2.0 aka AJAX, jQuery and other cl...

ASP.NET MVC with Postgres; ORM recommendations?

I'm project managing an intranet application being developed at work. We're in the early planning stages. I've previously done all my development in Python using Django, but as we're a windows shop we're probably going to go with ASP.NET MVC. We won't really be able to afford a SQLServer license though, so we were perhaps looking into u...

Best way to create form with Html.BeginForm() that should be SSL?

I have a form on a non-SSL page that I want to submit as SSL. I am creating the form using Html.BeginForm but that isn't required. It would also be nice if I could make it configuratble, so that i could have a flag that I set so that on the dev server or on my laptop I can turn the SSL off and turn it on in the production server. I know...

Getting parserror using Jquery+ASP.Net MVC on Firefox

I've got a simple $.ajax request that I am trying to fetch some HTML content with in my ASP.Net MVC app. // Load the claim table function GetClaimTable() { $.ajax({ type: "GET", url: "claimtable", data: {}, datafilter: null, dataType:'text', succ...

Can eTag be used for smart client caching in asp.net MVC as in Rails?

I've found in this screencast ¹ that you can do, in Ruby in Rails, a better client caching ² considering REST + model for filling eTag. Way more smart than render all the http body and only after all this, calculate the eTag, as usual. This property can make the client caching more model-oriented when using GET, so I think this is great...

Cleanup user input library .NET

Is there a .Net library which everyone uses to validate/cleanup user input from website. It seems like there are a lot of posts explaining which regex people use and when. While I do like to reinvent the wheel quite frequently I draw the line at user input. Mostly I am not worried about SQL injection, but rather am concerned about html...

LINQ to SQL: OnValidate() and custom domain model classes

Working through the NerdDinner Tutorial, I'm trying to figure out a good way to perform validation on properties that isn't dependent on a LINQ-to-SQL generated partial class. Here's some example code of what I've done so far: public abstract class DomainEntity { public IEnumerable<ValidationError> ValidationErrors { get; private s...

Is my ASP.NET MVC application structured properly?

I've been going through the tutorials (specifically ones using Linq-To-Entities) and I understand the basic concepts, however some things are giving me issues. The tutorials usually involve only simple models and forms that only utilize basic create, update and delete statements. Mine are a little more complicated, and I'm not sure I'm ...

Custom Authorize Attribute additional Param?

hi everyone. im looking for a way to customize my Authorize Attribute so that i can implement it correctly with my own MembershipProvider. What i need is to have the IsInRoles(string role, int perm) for example, in other word, i want to have it replace with a new IsinRoles or maybe create another method to archive this result. Is it p...

How to create a cookie for login? Or should I stick with asp.net membership?

Hi I am using asp.net MVC with the asp.net membership but I starting to think that there is no point for me to use Asp.net membership. So I would like to figure out how to generate the same type of cookie with the same fields and the one the asp.net membership one does. Also is there any other settings I need? Like how about stuff lik...

JS file not being updated when testing ASP.NET MVC app with VS2008

Hi, I have a MVC app developed in VS2008. When I run the app the changes I made to a JS file are not being updated. Is this the browser problem (IE7) or VS2008 dev server problem?? If I use Firefox it is updated? Malcolm ...

TempData and patterns

TempData persists for one more future request, isn't this anti REST ? and what situations it's desired to use it ? ...

ActionLink behaving differently

I have an action link like: <%=Html.ActionLink<ArticlesController>(x => x.Modify(item.id),"Modify") %> This is working perfectly rendering the link like: http://localhost:53574/Articles/Modify?idArticle=8 The same view is rendered in another page but this time the link is rendered with an empty href: <a href="">Modify</a> Could...

Custom Validation or Remove Validation on collection of object

We are facing a scenario..here it is: Our Customer Model has collection of Address object. The form displays 3 address for the customer for their input. However only the first address is mandatory. Now our Validation is on the Address Model, something like, "street address cannot be null". So when the form is submitted, the validatio...

How to override an existing extension method

I want to hide extension methods included in the .NET or ASP MVC framework by mine. Exemple public static string TextBox(this HtmlHelper htmlHelper, string name) { ... } Is it possible? i cant use the override or new keyword. ...

ASP.NET MVC View Engine Comparison

EDIT: added a community wiki answer to begin capturing people's experience with various View Engines. Please respectfully add any experiences you've had. I've been searching on SO & Google for a breakdown of the various View Engines available for ASP.NET MVC, but haven't found much more than simple high-level descriptions of what a vi...

How should I make this? With an Table cell Html helper or some other way?

Hi I am using asp.net mvc and I am not sure how to approach this problem. I have a table in my database and that has some fields in it. I want to generate a table with this. So I first tried to make a html helper that would make the table and and all the stuff I need but I am finding it too hard to maintain and causing problem for the ...

GenerateLink does not return the control name and the view name only for the INDEX view

Hello, I try to get a link by the method GenerateLink like this HtmlHelper.GenerateLink(this.ControllerContext.RequestContext, RouteTable.Routes, "My Link", "Default", "Index", "Home", null, null); This method works very well except when I get the link with a "index" view, she returns a URL like this "http://localhost:61406/Guide" it...

How to obtain the relative root path of application being developed in C#.NET MVC?

I have a few unit tests that require files from the project to be used to run the unit tests. These files are just images. I need to get the image file using some kind of function within c#, other than pasting the full path like below. string filePath = @"C:\Users\user1\Documents\Visual Studio 2008\Projects\app1\app1.Tests\Fakes\test_...