actionlink

ActionLink not producing the correct link

I am using MVC 2, and having a slight issue with the ActionLink not going to the correct controller The following line of code, which displays a logoff link <%= Html.ActionLink("Log Off", "LogOff", "Account", new { @class = "loginStatus" })%> It does not appear to be going to the Account controller The link it is make is: http://lo...

Html.ActionLink() gives me an empty link when I use it inside Html.RenderAction()

I have a Microsoft MVC project with an action "Foo" whose view ("Foo.aspx") contains the lines: <%= Html.ActionLink("mylinktext1", "bar") %> <%= Html.ActionLink<MyController>(x => x.Bar(), "mylinktext2") %> When I hit this from a web browser or load it from an AJAX call, it properly returns: <a href="/bar">mylinktext1</a> <a href="/B...

How to keep search term for additional pages when paginating

Hi all, I'm using a pagination method for displaying search results returned from my database. I'm creating an Html.ActionLink for each extra page, and what I'm wondering is, how do you put the string that was searched into the ActionLink? Below is part of my partial view that I'm populating a div with. It comes after the results so the...

How to manipulate Html.ActionLink to show a link to another controller?

In the Details view of the HomeController, I'd like to create a link to the Email view on the MiscController. In addition, I need to add an item to the QueryString. I'd like to create a link that goes something like: <a href="http://www.blah.com/misc/SendMail?id=6"&gt; <font size="1">Report problems</font> </a> I've tried the ...

mvc actionlink show html tags

how can i show html tags like this html.actionlinlk("<b>bla bla</b>", null) it dislay bla bla not bold bla bla-is it possible to show bold text? ...

Performance impact of wrapping ActionLink extension method inside a partial view

What would be a performance impact if I wrapped every call to an action link (ex. <%=Html.ActionLink(....)) inside a partial view. So in other words instead of calling html extension method for actionlink I would call a html extension method for rendering partial view, and my partialview (user control) would execute the Html.ActionLink(....

Edit Html.ActionLink output string

I'm trying to output the following HTML using Html.ActionLink: <a href="/About" class="read-more">Read More<span class="arrow">→</span></a> I'm getting it done by doing an ActionLink, which outputs an <a> tag and then manipulating the string. <%= Html.ActionLink("[[replace]]", "Index", "About", null, new { @class = "read-more" }).ToH...

Pass Dictionary of routeValues to ActionLink

All, Getting to grips with ASP.NET MVC. So far, so good, but this one is a little nuts. I have a view model that contains a dictionary of attributes for a hyperlink, used like this: menu = model variable Html.ActionLink(Html.Encode(menu.Name), Html.Encode(menu.Action), Html.Encode(menu.Controller), menu.Attributes, null) The proble...

How do you link to an action that takes an array as a parameter (RedirectToAction and/or ActionLink)?

I have an action defined like so: public ActionResult Foo(int[] bar) { ... } Url's like this will work as expected: .../Controller/Foo?bar=1&bar=3&bar=5 I have another action that does some work and then redirects to the Foo action above for some computed values of bar. Is there a simple way of specifying the route values with Red...

MVC actionlink posting List of complex type

I have an actionlink that on click im passing a List of objects to a controller action. Example: View: Html.ActionLink("TestLink", "TestMethod", "Test", Model.SampleList, null) TestController: public ActionResult TestMethod(List<SampleList> sampleList) { return View(sampleList); } When I do this I get a null sampleL...

ASP.NET MVC Ajax: Error with Ajax.Actionlink ('b.apply' is not a function in MicrosoftAjax.js)

Hello, I made some changes to my ajax test website and now my Ajax.ActionLinks don't work anymore! The ActionLinks in question are made like this: <%=Ajax.ActionLink("Language Select", "LanguageScreen", "Home", from("LanguageScreen", "Functions"), meep("LanguageScreen", "Functions"))%>` The "from" and "meep" functions are only one li...

ASP.NET MVC - creating and handling with URLs with Greater Than and Less Than characters

Consider a link to a page for a user's profile. A page is creating that URL like this: //Model.Name has value "<bad guy>" Html.ActionLink("foo, "ViewUser", new { id=5, title=Url.Encode(Model.Name) }) The actual outcome was http://mysite/Users/5/%253cbad%2guy%253e When navigating to that URL, the server generates a HTTP Error 400 - ...

Using Html.ActionLink and Url.Action(...) from inside Controller

I want to write an HtmlHelper to render an ActionLink with pre-set values, eg. <%=Html.PageLink("Page 1", "page-slug");%> where PageLink is a function that calls ActionLink with a known Action and Controller, eg. "Index" and "Page". Since HtmlHelper and UrlHelper do not exist inside a Controller or class, how do I get the relative UR...

ASP.NET MVC ActionLink vs. URL Rewrite

Hello, here is the issue : There is a ASP.NET MVC 2 web app, lets call it myapp.com. I want dynamic subdomains (user created categories) like something.myapp.com. So i have set up URL rewrite with rule rewriting something.myapp.com -> myapp.com/something (which is handled by MVC next..). But, the first ActionLink throws an exception Sy...

Trouble with ActionLink

Hello there, I wanna know if there's a way to do something like webforms .. Or a nice way to do this .. I have an ActionLink("foo", "fooAction") on my "Index" view. In this fooAction, I call a method that returns "True" or "False" and depending on the return, I have to give to the user, some feedback and return the "Index" with the same...

How to pass javascript function as a parameter in the route values of Ajax Actionlink

Hello experts, I need to pass javascript function as a parameter value to the ajax actionlink in asp.net mvc app. how can we achieve this? Thanks in advance. ...

how to perform click to the output of ActionLink by jQuery or javascript?

<%= Ajax.ActionLink("Edit", "Update", "Home", new { id = item.mID }, new AjaxOptions { OnBegin = "function(){ $('#edit" + item.mID + "').show();}", HttpMethod = "get", UpdateTargetId = "edit" + item.mID })%> The above code generates the html source code. when user click the link, it works well. But there're so many links there, I must ...

html.actionlink with .net 4.0 renders empty links

This should hopefully be a simple configuration problem. When my application targets .Net 3.5 This code <%= Html.ActionLink("Forgot your password?","ForgotPassword") %> renders this: <a href="/Account/ForgotPassword">Forgot your password?</a> When my application targets .Net 4.0 The same code renders: <a href="">Forgot your ...

Asp.net MVC Calling ActionLink in Codebehind

I am new to asp.net and MVC, so please go easy on me. :) I have successfully made a small MVC application. There is a database that contains a table named "Entry" and I have made Controllers for this. Also I have a view for Details and list. This works fin. My problem is in my index page. (not the view Index, but the frontpage). There ...

Ajax actionlinks straight from a DropDownList

I've got a small linkbox on the side of my page that is rendered as a PartialView. In it I have a dropDownlist the should change the routing value of the links in the box but I'm having difficulty doing so. My current plan is to call on something similar to a Ajax.ActionLink to reload the partial view into the with a different paramet...