Im working on a project in MVC and have enjoyed learning about it. There are a few growing pains but once you figure them out it's not bad. One thing that is really simple in the WebForms world is maintaining the scroll position on a page. All you do is set the MaintainScrollPositionOnPostback property to true. However, in MVC, Im no...
I'm just starting to play with MVC, and something isn't clicking with me. I understand how to make a simple input form, and use a submit button to post the form set up like this:
<form runat="server" method="post" action="/Home/CreateNew" >
But what happens if you're whole app is inside one form tag, and you want to have multiple inpu...
I'm somewhat new to the ASP.NET MVC architecture and I'm trying to sort out how I could return multiple sets of data to the view.
public ActionResult Index(string SortBy)
{
var actions = from a in dbActions.Actions
orderby a.action_name
ascending
select...
Hello. I have problem with ActionLink.
I'd like to pass to my ActionLink parameter for my MessageController, for Edit action: to generate somthing like this /MessagesController/Edit/4
So I have ListView control with binding expression:
<%# ((Message)Container.DataItem).CreationDate.ID %>
and how to pass this ID to ActionLink as paramete...
Hi,
I have a custom view engine in ASP.NET MVC and since upgrading to RC1 my custom view engine that implements Areas as in this post by Phil Haack does not enter the override method FindView, thus breaking any controllers that sit within an area as the application is unable to find them. As I'm aware that a good number of people are u...
I just got my first Unit Test project working, and immediately ran into some problems. One of the nice details about the Unit Testing concept that were pointed out to me was that I won't have to mock up http-contexts or such in order to test my application.
However, I have made use of the Request.IsMvcAjaxRequest() check in my controlle...
The ASP.NET MVC controller action methods are primarily used for handling 'business' operations but it can be used for lots more.
I thought it would be fun to see what creative, useful things people have created actions for that may be practical or useful for others.
Here's my contribution :
Javascript file concatenator - to reduce nu...
I have an ASP.NET MVC form that may (usually does) submit a response that would trigger the "A potentially dangerous Request.Form value was detected form the client" error.
To try to get around this, I have placed a ValidateRequest="false" in the page directive.
Only problem: I'm still getting the error!
Now, all was good until I upda...
Trying to create a MVC User Control in the Release Candidate and I can't see to make one with a codebehind file. The same is true for MVC View pages.
Creating Views in the Beta would produce codebehinds...am I missing something?
...
Is there any attribute that one can put on a parameter for an action that tells LINQ to load a particular entity and only databind on the values that have changed a la Active Record/Monorail (see ARDataBinding)
...
I am using Fiddler to debug my MVC application and see all the HTTP requests.
The application is running on http://localhost:51234/mvc
As anybody who has tried to use Fiddler for a site hosted on localhost knows there is an issue - windows won't forward localhost traffic through the proxy if you hit this link directly. You can work aro...
Currently when I want to set html attributes like maxlength and autocomplete, I have to use the following syntax:
<%= Html.TextBox("username", ViewData["username"], new { maxlength = 20, autocomplete = "off" }) %>
Is there any way to do this without having to explicitly set the ViewData["username"] portion? In other words, I want to ...
What is the final/best recommendation for how to serve favicon.ico in ASP.NET MVC?
I am currently doing the following :
Adding an entry to the very beginning of my RegisterRoutes method :
routes.IgnoreRoute("favicon.ico");
Placing favicon.ico in the root of my application (which is also going to be the root of my domain).
I have t...
I was using Html.RouteLink("LINKTEXT","RouteName",new RouteValueDictionary()) in asp.net MVC beta without problem, today I upgrade to ASP.NET MVC RC and this does no create the link anymore. The route still works because I type in the browser and I go to the Page I want. Any help?
...
I'm working on a basic Issue Management System in order to learn ASP.NET MVC. I've gotten it up and running to a fairly decent level but I've run into a problem.
I have a controller named Issue with a view called Open. /Issue/Open lists all of the open issues currently logged on the system. I've defined a route like so:
routes.MapR...
I have an Ajax actionlink that requests a string in the controller method. I want to insert that string into an attribute of a hyperlink. HOw do I specify the attribute field of the target id element?
<img id="CHANGE-MY-SRC" src=ViewData["src"] >
<%=Ajax.ActionLink("Change IMG Source","actionChange",new AjaxOptions()
UpdateTar...
The reason I am asking this is due to my observation that frameworks like RoR and Django are two of the leading MVC frameworks out there which really have stirred up the community. I know there are MVC frameworks in Java world long before RoR or Django came out, but there wasnt so much excitement.
Are languages like Ruby / Python a bett...
Hi All,
I create an amount of actions in MVC controllers.
public ActionResult DoSmth1(string token)
public ActionResult DoAnother2(string token)
And when I have to call ActionLink..
=Html.ActionLink<SomeController>( x=> x.DoSmth(item.property), item.property)
=Html.ActionLink<AnotherController>( x=> x.DoAnother(item.property), item....
I have a small ASP.NET MVC application developed using the latest beta version.
What would be an easy to follow step-by-step guide to upgrade to the RC released yesterday?
What key changes would I have to apply to get it working in the new version?
...
Hi,
Using .net MVC and I am doing some server side validation in my Action that handles the form post.
What is a good technique to pass the errors back to the view?
I am thinking of creating an error collection, then adding that collection to my ViewData and then somehow weave some javascript (using jQuery) to display the error.
It w...