asp.net-mvc

asp.net mvc wiki

Hello there I need to provide a wiki page for an app which would be like an island pretty much - little like codeplex wiki page e.g. site/Products/Details/1/Wiki site/Products/Details/99/Wiki site/Products/Details/2423423/Wiki site/Some-other/page/page-id/Wiki If there's a master admin page, that'd be fanstastic but is not a requ...

Model Binding on Multiple Model Form Submission from Strongly-Typed View

...

ASP .Net MVC save and replay post data

Hello, I am trying to figure out how to do the following: 1) After a form is submitted, serialize the raw post data and store it to a database 2) Read the post data from the db and replay it by re-posting it to the same URL To explain my end goal, we have three main envs: dev, acceptance, and production. I would like to be able to m...

ASP.net and CustomModelBinder and a prefix

With the default ModelBinder and its attribute Bind we can set a prefix like this: public ActionResult Save([Bind(Prefix="test")] Person p)) { } I have a CustomModelBinderAttribute which returns a bespoke ModelBinder: public ActionResult Save([PersonBinderAttribute(Prefix="test2")] Person p)) { } How do I access the value of Pref...

How to get MvcApplication instance in Asp.NET Controller?

I think MvcApplication is a global singleton. I want to get the instance of MvcApplication in controller. Then I put following code in controller: MvcApplication app = HttpContext.Current.Application as MvcApplication; it give me error: Error 2 'System.Web.HttpContextBase' does not contain a definition for 'Current' and no extension m...

Switch MasterPageFile at runtime

During runtime, is there a way to specify which MasterPageFile a view should use? Basically when the view is rendered I need to tell it which Master Page File to use which may be obtained from a database or something. ...

How can dynamic breadcrumbs be achieved with ASP.net MVC?

How can dynamic breadcrumbs be achieved with ASP.net MVC? If you are curious about what breadcrumbs are: What are breadcrumbs? Well, if you have ever browsed an online store or read posts in a forum, you have likely encountered breadcrumbs. They provide an easy way to see where you are on a site. Sites like Craigslist use breadcrumb...

Anyone have any knowledge on implementing Facebook Connect on an Asp.Net MVC app? (Or even a good tutorial to look at)

The only tutorial I've found so far is: http://my6solutions.com/post/2009/04/05/Integration-of-Facebook-Connect-on-ASP-NET-MVC.aspx I tried following it but it didn't get me anywhere because it kept saying there were missing methods (I'm guessing because the edited files he gives you is edited from an old copy of the facebook connect so...

how to add querystring values with RedirectToAction method?

Hi in asp.net-mvc, I am using RedirectToAction("myActionName"); I want to pass some values via the querystring, how do I do that? ...

Error running ASP.NET MVC on IIS 7

Hi, I have been trying to deploy my asp.net mvc site to IIS 7 and having a bit of an issue. Whenever I run the site, I get a "Could not load type 'System.Web.Mvc.ViewPage'.". When I try to access a page with a master page, I get a Could not load type 'System.Web.Mvc.MasterViewPage'" error. I tried using tracing rules in IIS 7 to narro...

User.Identity.Name blank in ASP.Net MVC

Exactly as per the title. Simply in my HomeController I have: string Username = User.Identity.Name; Why is this value always blank? Is there something special I have to place in the web.config to get this value to come through. I've tried on both the VS dev web server as well as on a windows server 2003 IIS server. It's got to be s...

How to test Model of attached DB in my ASP.NET MVC project?

I created a standard ASP.NET MVC project and then added a SQL Express database in the App_Data folder. The connection string is recorded into the web.config file. I then created a LINQ to SQL data model for the database. I want to test the data model from my Test project but I don't know how to go about this correctly because I am using ...

how can i run code when an application ends with asp.net mvc

how can i run code when an application ends with asp.net mvc ? ...

MVC Controller Called twice

I have a Product controller with Index action, which basically creates the view form for post and Index (Post action verb) action on the ProductController which basically save the product to db but when validation errors occur, I am returning a View(mymodel) else when saved, I am returning RedirectToAction("Created,"Product") but for som...

How to store multiple versions of DB data for auditing/merging?

I'm using ASP.net MVC and SQL Server, but I don't think the answer will depend on this architecture, and I'm equally interested in solutions that use other architectures. So... I have an object (row) within SQL that needs to be: versioned, updated by multiple people, approved, and merged. OPTION A) For a quick-and-dirty solution, I'm d...

Design question - using an event, attribute, or not? (mvc)

I'd like to know what you think of the following design options. I have an 'AgendaController' (.NET MVC project) which handles user actions like viewing their agenda, making appointments, etcetera. When a user makes an appointment, the appointment is saved in a database. Then, there is a 'secondary' task that has to be done, in this cas...

Can't pass viewmodel to new action by RedirectToAction

I have a form, when user submit the form, I want to direct the user the new view to display the submitted result(transfer viewmode data to display view). public class HomeController : Controller { private MyViewModel _vm; ..... // POST: /Home/Create [AcceptVerbs(HttpVerbs.Post)] publi...

What does it mean to unit test an MVC view?

On a new ASP.NET MVC application we are following a TDD approach, using NUnit for unit testing and Unity for Dependancy Injection. Our views are being made as "dumb" as possible by adjusting our models to supply data in the most appropriate fashion for our views. Is there a merit in unit testing our views? If so - how? ...

How to call controller action on page load in asp.net mvc

Hi, I have a view that looks like this: http://whatever/Download/viaId/12345 And i would like to call the action public void viaId (int Id) { //Code } when the page loads. Right now I only have the controller implemented and when I browse the url the parameter Id is null. Do i need to create the view and call it through javas...

How can I post an object in ASP.NET MVC?

Hi everyone! I have a View that receives a List of an object and for each object in this list I generate a Partial View. It's a seach result, such as Google. Each result will be wrapped in a form and each result will have its "save" post button. So, when I post a form, I will lead user to another page where he will confirm the result ...