asp.net-mvc

Simulating Ajax failures for QA testing

Our first ASP.Net MVC/jQuery product is about to go to QA, and we're looking for a way for our QA guys to easily be able to simulate bad Ajax requests (without modifying the application code). A typical integration/UI test plan might be: Load page, click button "DoStuff" "DoStuff" fails Attempt button "DoStuff" again "DoStuff" succe...

Can not find StructureMapConfiguration object

I see a lot of exampls of how to use StructureMap in a asp.net project like this: StructureMapConfiguration.ForRequestedType<IResourceA>() .TheDefaultIsConcreteType<ResourceB>() .CacheBy(InstanceScope.Singleton); Yet, in my Global.asax I can not access the StructureMapConfiguration object even when I import the StructureMap na...

building an ASP NET MVC site, should i go with linq to sql?

So I'm about to start a new website from scratch and I've spent about a week trying to figure out what technology to go with. I'm sold on ASP NET MVC. I'm 100% sure I'm going to love using that. but what i am not so sure about yet is using Ling-to-SQL. So far I've gathered some data... StackOverflow uses it - can't be that bad can be ...

how to set httpheaders in asp.net mvc

I need to set http header for disabling ie (7-8) caching (it disturbs my ajax functionallity). I've tried inserting this code to the head of my site.master with no result - <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> How and where can I set the HTTP headers? or do you have a better solutio...

Strategy in exporting to Excel with formatting from ASP.NET?

So this is another exporting to Excel question. I have a page that has a table with formatting by stylesheet. When I export the page by setting the ContentType to application/excel and Content-Disposition to attachment, I can export the table to Excel (not CSV). However, it loses all formatting. I think it's because Excel does not loa...

Drop Down List in MVC

I want to do the following: 1: Add two dropdown list in the register.aspx [Say ddlRole,ddlGender] 2: Fill the dropdown list [ ddlRole should be filled from the database, and ddlRole should have two static field] 3: On submit I want to get the selected value of the two dropdown list. Please help. Thanks in advance. ...

Can you make Asp.net MVC View wireup compile time safe?

Take the standard return statement for a controller: return View("Index"); is there a way to make this thing compile time safe? using static reflection or some other trick? ...

How can I use a custom ValidationAttribute to ensure two properties match?

We're using xVal and the standard DataAnnotationsValidationRunner described here to collect validation errors from our domain objects and view models in ASP.NET MVC. I'd like to have a way to have that validation runner identify when two properties don't match through the use of custom DataAnnotations. Right now I'm forced into doing i...

Generic data input form in asp.net mvc application

Hello, I have an application that have EF 16 classes that share this information: They all are classes only with a key field and a description. I think it should be a waste if I make a controller with just 1 method just to present a form to fill these classes info, then I was thinking in to make a generic form(with key, description) and ...

ASP.NET MVC Session Expiration

We have an internal ASP.NET MVC application that requires a logon. Log on works great and does what's expected. We have a session expiration of 15 minutes. After sitting on a single page for that period of time, the user has lost the session. If they attempt to refresh the current page or browse to another, they will get a log on page. W...

Passing multiple parameters in an MVC Ajax.ActionLink

I am using an Ajax.ActionLink to call an Action in a Controller, nothing special there. I want to pass two parameters to the Action. Is this possible using an Ajax.ActionLink? I thought that it would just be a matter of including multiple values in the AjaxOptions: <%= Ajax.ActionLink("Link Text", "ActionName", "ControllerNam...

ckeditor problem: extra html tags in source

I am creating an editor in asp.net MVC application using ckeditor. In textarea i have just written "Sample Text", but when i load the ckeditor and click on source button of ckeditor it gives me a lot of html like html > body > p > [Sample Text]. Why its creating extra html tags?? i have to send the content to database for saving html but...

"Error opening associated documents" message when loading VS

When loading up a solution in VS2008 I get this message: An error was encountered while opening associated documents the last time this solution was loaded. Document load is being skipped during this solution load in order to avoid that error. It shut down immediately the first time I opened it. The next time I opened it...

Deploying ASP.NET MVC web project by remotely building committed VisualSVN code

Publishing my entire application to a server in the U.S. every time I change a single line of code is taking FOREVER. I'm running VisualSVN server on my production server. How can I auto-build my project (to a development site folder) on the server whenever a commit is made? And is this a good practice? Update: I'm now looking into t...

Dynamic 'twitter style' urls with ASP.NET

I am looking to produce an MVC site which has complete control of the url structure using routing. The specific requirements are: www.mysite.com/ = homepage (home controller) www.mysite.com/common/about = content page (common controller) www.mysite.com/common/contact = content page (common controller) www.mysite.com/john = twitter s...

Control JSON Serialization format of a custom type in .NET

I have a PhoneNumber class that stores a normalized string, and I've defined implicit operators for string <-> Phone to simplify treatment of the PhoneNumber as a string. I've also overridden the ToString() method to always return the cleaned version of the number (no hyphens or parentheses or spaces). In any views where I display the nu...

How to Route /About to /Home/About

Just getting started with ASP.NET MVC and it's great! But I don't quit understand setting up routes. How do I route ~/About to ~/Home/About? /Views/Home/About.aspx I would like to be able to access it with /Home/About or just /About ...

asp.net MVC should a View-Model Encapsulate Domain-Model?

Hi all I've see a lot of MVC examples where domain-objects are passed directly to views, this will work fine if your view is simple. The common alternative is to have a view-model which has all the same properties as your domain-model + any extra properties your view may need (such as 'confirmPassword'). Before doing too much reading a...

ASP.NET MVC: what mechanic returns ViewModel objects?

As I understand it, Domain Models are classes that only describe the data (aggregate roots). They are POCOs and do not reference outside libraries (nothing special). View models on the other hand are classes that contain domain model objects as well as all the interface specific objects like SelectList. A ViewModel includes using Sy...

Retain a list of objects and pass it to the create/edit view when validation fails in ASP.NET MVC 2

I am binding a Foreign key property in my model. I am passing a list of possible values for that property in my model. The model looks something like this: public class UserModel { public bool Email { get; set; } public bool Name { get; set; } public RoleModel Role { get; set; } public IList<RoleModel> Roles { get; set;...