actionlink

Conditionally add htmlAttributes to ASP.NET MVC Html.ActionLink

I'm wondering if it's possible to conditionally add a parameter in a call to a method. For example, I am rendering a bunch of links (six total) for navigation in my Site.Master: <%= Html.ActionLink("About", "About", "Pages") %> | <%= Html.ActionLink("Contact", "Contact", "Pages") %> <%-- etc, etc. --%> I'd like to include a CSS clas...

ASP.NET MVC: Ajax.Actionlink Does not work with parameters

<%= Ajax.ActionLink("DrillDown", "EventOverzichtAjax", new { GroepID = Model.GroepID.ToString(), groepType = Model.GroepType.ToString(), manager = Model.isManager }, ...

mvc ajax.actionlink with jquery dialog confirm

I have a table with some rows of data items. For each row it will be some actionlinks that will call some methods (delete dataitem, change status dataitem etc...) Before each user clicks the button i want a jquery dialog to show up and give the user a dialog with some info, a OK and Cancel button. Some example code of the ajax.actionli...

Configuring ASP.NET MVC ActionLink format with GoDaddy shared hosting

Background I have a GoDaddy shared Windows hosting plan and I'm running into a small issue with multiple domains. Many people have previously reported such an issue, but I am not interested in trying to resolve that problem altogether; all I want to accomplish is to change the format of my ActionLinks. Issue Let's say the domain th...

MVC Ajax.ActionLink doesn't find POST method

I have a POST method declared in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateComments(int id, string comments) { // ... } and an ActionLink in my view: <%= Ajax.ActionLink("update", "UpdateComments", new { id = Model.Id, comments = "test" }, new AjaxOpt...

ASP.Net MVC Outbound Route Matching Problem When Using ActionLink

Hi there, Hoping for some help after reading into MVC routing and not coming up with the answer myself. I have the following routes registered: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( null, "YourFeedback/...

Possible to write an Extension Method for ASP.NET's Html.ActionLink() method?

Right now, I'm trying to work around an IE6/7 bug which requires the wrapping of the </a> closing tag with this IE specific comment to make some drop-down menu work: <!--[if IE 7]><!--></a><!--<![endif]--> Unfortunately, I cannot inject this directly into my View page code like this: <%= Html.ActionLink("LinkName<!--[if IE 7]><!--></...

Ajax.ActionLink is not POSTing

I am trying to navigate to an MVC action by POSTing rather than GETting. (The action is a DELETE, and I don't want it reachable by an external link.) I am using a link in a grid generated by Ajax.ActionLink("Remove", "Delete", new { saID = Model.Said, id = e.id }, new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure you want...

Getting Ajax return to replace whole page

This is a followup question to the one I posted last week "Ajax.ActionLink not Posting". I did finally get it to Post, and it properly calls my Delete action and deletes the record. The Delete method returns a RedirectToAction("List") so that the new data set minus the deleted record is re-listed. Except that what actually happens is ...

asp.net mvc2 Hw do I use Actionlink to jump from root straight to details page

On a root page in my project I have a number of different country services gathered by category all on one page. The Category is the "Index" page in the View folder in a separate area, and the particular service is the "Details" view. I want the user to be able to jump straight past the category in the (in this case China) area to that p...

Proper way of building MVC ActionLink

I've got an MVC ActionLink like so (which works just fine) <%: Html.ActionLink(user.UserName, "Details", "Users", New With{.id = user.ID, .slug = Replace(user.UserName," ","-")}, nothing)%> But since it's not "recommended" to do string manipulation in the View, I'm wondering how I could build a custom Html ActionLink to do the string ...

S#arp ActionLinkForAreas + Parameters + custom routes - UPDATED!

Does the ActionLinkForAreas link extension work with parameters + custom routes? I have a route that exists matching my action which is: routes.MapRoute("Profile", "profile/{artist}/{action}", new {controller="Profile", action="Index"}); But when I call ActionLinkForAreas like this: <%= Html.ActionLinkForAreas<ProfileController>(x =...

IE div, updatetargetid not refreshing on subsequent requests

I am facing an issue while showing the partial view in div with updatetargetid property of Ajax.ActionLink. This is my controller- [HandleError] public class HomeController : Controller { static NumberViewModel model = new NumberViewModel(); public ActionResult Index() { model.IsDivisibl...

moving to page section through URL

I am trying: <%= Html.ActionLink("Link Label", "Index", "controller_name", new { area = "AreaName" }, new { @id = "documentation" })%> To create the appropriate html to send the user to the "documentation" part of the web page by rendering the id into the title (i.e. ) and then dropping the "#documentation" onto the end of the url lik...

Need some help understanding the usage of this Html.ActionLink().

I'm following the NerdDinner ASP.Net MVC tutorial and I have the following line of code: <%= Html.ActionLink("Edit Dinner", "Edit", new { id = Model.DinnerID}) %> | <%= Html.ActionLink("Delete Dinner", "Delete", new { id = Model.DinnerID }) %> What I don't understand is why the third parameter of the ActionLink requires a new ...

Asp.net Mvc2 Ajax ImageActionLink Helper

I'm fairly new to Mvc and ran into a problem try to use an Image as an Ajax Action link. I found a helper that I believe was posted by Stephen Walther... using System.Web.Mvc; using System.Web.Mvc.Ajax; namespace Helpers { public static class ImageActionLinkHelper { public static string ImageActionLink(this AjaxHelper...

MVC make action link perform a submit

I am currently trying to make an html submit occur, but using the MVC helper method ActionLink as I do not want it to be a button, I want it to be an underlined link like the rest on my page. This is what I have currently <%= Html.ActionLink("Delete Selected", "DeleteCheckBox", "Domains", "Default.aspx", new { type="submit" }) %> This...

ASP.NET MVC and Ajax slow?

I've just started out trying MVC 2 and Ajax, and I'm wondering if I'm doing something wrong, because I was under the impression that Ajax would make changes in a webpage very fast. The example I have is with the Ajax actionlink: <div> <%: Ajax.ActionLink("Dita", "AjaxView", new AjaxOptions { UpdateTargetId = "myDiv" })%> </div> <div i...

ActionResult with optional routevalues affecting other actionlinks on view

I have an actionresult that looks like: public ActionResult MyFriends(Guid? friendId) { if (friendId != null){ return View(...); { else{ return View(...); } } If the friendId is supplied, I return a certain model that my view knows how to react to. Otherwise, if no friendId is given, the view r...

Working with links asp.net mvc2

How do I make a static link in a view? (using ASP.NET MVC2) I am working on the site navigation, and have basically 4 main areas. These are split into sub areas, and one controller looks after the entire "main area". So basically after clicking on a main area, i'd like to display a list of links to the different sub areas. I created th...