asp.net-mvc

Post from one ASP.NET MVC site to another

Is it possible to post a form from one MVC site so that it invokes the POST action in a controller on another site ? I can do a GET easily, but a browser redirect is always a GET as per my understanding and I am unable to invoke the target site's POST action. e.g. http:/siteA.com/test invokes http://siteB.com/result/signin ... in the Re...

Visual Studio 2008 with SQL Server 2005 Developer Edition

I am trying to add a database to the App_Data location in an ASP.NET MVC 2 application in Visual Studio 2008 (VS). I have SQL Server 2005 Developer Edition installed on the local machine. However when adding the database VS complains that SQL Server 2005 Express is required. I configured VS to use the local server instance (MSSQLSERVER)...

Best practices for model definition in ASP.NET MVC

Recently I've read, and implemented 80% of examples from Pro ASP.NET MVC Framework, and it seems like the authors have only given the basics. After reading this I did become able to build web applications using ASP.NET MVC. But that's just basic applications. What I found most confusing is that at the beginning the authors emphasized on...

Whats so great about the new MVC2 areas?

Could some one please explain the advantages and disadvantages of using the new MVC2 Areas feature? I don't understand what is so great about them. If I am adding an admin area to my MVC application why not create a new Admin folder in the main Views and Controllers folder? What does creating an area really get me? I fail to see much ...

How do I pass a list of integers to an MVC action?

I have an action that depends on a list of integers. My first instinct was to simply declare the action with a List. I tried declaring the action in the controller as: public ActionResult EditMultiple(List<int> ids) and in my View call like so: <%= Html.ActionLink("EditMultiple", "EditMultiple", new { ids = new List<int> {2, 2, 2} ...

Can't convert HttpFileCollectionBase to HttpFileCollection...

I have a partial view: <% using (Html.BeginForm("add", "home", FormMethod.Post, new { enctype = "multipart/form-data" })){%><input name="IncomingFiles" type="file" /><div class="editor-field"><%: Html.TextBox("TagsInput") %></div><p><input type="submit" value="Create" /></p><% } %> And this in the controller: [HttpPost] publ...

ASP.Net MVC Keeping parameter names and action argument names in sync.

I've noticed a pattern that can make refactoring MVC2 apps difficult. When you change the name of an argument for an action you must update the values everywhere that action is used. For example, public ActionResult List(string p) in the view <%= Html.ActionLink("List", "Directory", new { p = "somePath" }, null) %> What if I want t...

Is this the correct pattern to return different views from an ASP.NET MVC controller?

I have an application that has an public 'end user' mode and a 'back office' mode. Both 'modes' pretty much share the same controller logic but the user interfaces for these different 'modes' are radically different. Using the out of box default routing that you get when a project is created for the first time I have something like the ...

DataAnnotation attributes not working in Asp.Net MVC2

Hello, I am having trouble with the with mvc2. I am using the Entity Framework as my ORM. I have used the POCO Entity Generator to create POCO objects. I moved the generated objects to a separate project. I followed steps outlined here(Tutorial). This is my project structure Sports.Data - Entity Frmework and Data Access Sports.Entiti...

Book suggestion on this DDD concept specific to ASP.NET MVC and JSON?

I am looking for a book or blog entry on the following DDD concepts, something specific to MVC and C# code. Quick summary: partially populated domain models from special repository methods and sending only changed domain model properties as JSON back from the client. More details: If you have a Customer object but need a drop down li...

How do I render a multiple-model CREATE form on the fly?

It's a multi-model view, and I'm achieving this through an IList<Book>. Each Book has a Title and an Author So for example if I wanted to make 3 Books: <%= Html.TextBoxFor(m => m[0].Title) %> <%= Html.TextBoxFor(m => m[0].Author) %> <%= Html.TextBoxFor(m => m[1].Title) %> <%= Html.TextBoxFor(m => m[1].Author) %> <%= Html.TextBoxFor(...

Loading related objects without multiple database calls

I'm just learning LINQ to SQL and have run into the following obstacle. I have a the following 3 tables: PC (PCGUID, ParentPCGUID, ModelName, RetailerGUID) Offer (OfferGUID, ParentGUID, Title) Retailer (RetailerGUID, Name) With the following relationships: PC 1:N Offer Retailer 1:N PC Retailer 1:N Offer PC 1:N PC (self refere...

How do I dynamically build a list of objects in a CREATE view?

I have an Employee model that has a Name and Company I want to be able to build multiple Employees in one CREATE view. I figured I need to create an IList<Employee> and do something like: <%= Html.TextBoxFor(m => m[0].Name) %> <%= Html.TextBoxFor(m => m[0].Company) %> <%= Html.TextBoxFor(m => m[1].Name) %> <%= Html.TextBoxFor(m => m[...

JQuery function fails when content loaded from Ajax form

I have a problem with an image that I am applying a custom jquery function against. Consider the following block of code. <% Dim sUniqueIdent As String = Now.Ticks.ToString%> <div id="chart<%: sUniqueIdent %>"></div> <script type="text/javascript"> $(document).ready(function () { bindLinksForChart<%: sUniqueIdent %>(); });...

ASP.NET MVC 2 filling ViewModel data.

Right to the point: How would I map a Dictionary<String, String> to a ViewModel? The ViewModel contains properties of the same name of the Dictionary keys. To give more information, the program reads a database record and returns all of the values for the record in a Dictionary<String, String>. I only want to display 20-30 of these fi...

Is there any reasonably big web application (e.g 1M page views/month ) running on mono?

I have plans to work on a website using mono and asp.net mvc.But i would like to know where anyone has actually used mono for reasonably big production environment. ...

How can I intercept and handle an AntiForgeryToken exception?

I am using jQuery to post($.post) to a controller action and return a JSON result. If there are any errors, I'm returning the error message with the JSON result and displaying it to the user with a modal. However, I'm having a lot of trouble intercepting the AFT exception. Rather than throw a 500, I just want to grab the error mes...

ASP.Net MVC (1) - how can I pass JSON to view but not as separate ajax call...

I have some data that I want to pass into the View (.aspx page) in JSON format. I could add an async ajax call and load it that way, but since I have the data upfront, why not just dump it into the view. I could pass a C# object as the model and in Javascript manually iterate through it to fill out a Javascript object, but this seems l...

How do you globalise the ASP.Net forms authentication longinUrl for multiple languages?

Hi there, I hope someone can help with solution to this problem? Currently my ASP.Net MVC website uses forms authentication is set up like this my web.config: <authentication mode="Forms"> <forms loginUrl="en/User/Signin" timeout="2880" /> </authentication> We have some routing rules that use the prefix /en/ in the url as a identi...

Syntax Hightlighter Problem Loading Partials

Hi I'm using the syntax highlighter found here: http://code.google.com/p/syntaxhighlighter/ I have a page wherte it works fine: <div id="codeArea"> <pre class="brush:csharp"> var customers = new Customer().GetCustomerList().AsEnumerable() .Where(c => c.CustomerID < 5); </pre> However,...