actionlink

Attach image to ActionLink in MVC 4

ε祈祈猫儿з 提交于 2019-12-01 07:35:22
I am using ActionLink with id in MVC 4 app and assinging actionLink id an image in css but on on earth I am doing wrong. is not working! here is my code <div class="logo_container"> @Html.ActionLink(" ", "Index", "Home", null, new { id = "_Logo" }) </div> CSS .logo_container { width:339px; height:116px; } #_Logo { background-image: url("../Images/logo.png"); width:339px; height:116px; background-color:green; } This is from my application. Works ok: .logo{ background:no-repeat url(/Content/photo/png/sprite.png) 0 0; height:15px; width:20px; overflow:hidden; float:left; border:none; display

ASP.NET MVC Html.ActionLink result URL - the way of encoding

痞子三分冷 提交于 2019-12-01 05:38:51
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.property) ...it generates me different URLs: /Some/DoSmth/stringvalue /Another/DoAnother?property=stringvalue Where to set the way it builds an URL? I am alr have no ideas...(( OK, a got some waylight: - if the property names are the same that used in routing schema - eg

Attach image to ActionLink in MVC 4

雨燕双飞 提交于 2019-12-01 04:17:54
问题 I am using ActionLink with id in MVC 4 app and assinging actionLink id an image in css but on on earth I am doing wrong. is not working! here is my code <div class="logo_container"> @Html.ActionLink(" ", "Index", "Home", null, new { id = "_Logo" }) </div> CSS .logo_container { width:339px; height:116px; } #_Logo { background-image: url("../Images/logo.png"); width:339px; height:116px; background-color:green; } 回答1: This is from my application. Works ok: .logo{ background:no-repeat url(

ASP.NET MVC Html.ActionLink result URL - the way of encoding

雨燕双飞 提交于 2019-12-01 03:27:29
问题 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.property) ...it generates me different URLs: /Some/DoSmth/stringvalue /Another/DoAnother?property=stringvalue Where to set the way it builds an URL? I am alr have no ideas

Is it possible to use an ActionLink containing an element?

寵の児 提交于 2019-12-01 03:01:05
As the question says, Is it possible to use an ActionLink containing an element, and if not, what is the best way to achieve it? For example, lets say I have a Span element, I want the whole thing to be a hyperlink... The following works: <a href="/Site/Page/@Model.ID?Type=test"> <span class="box5">Click anywhere in this box</span> </a> Imagine that span/css class box5 makes this large... Was originally a DIV, but, I found that didn't follow standards and this appears to follow ok. This renders and works fine, but, is there anyway to use an ActionLink instead? I have tried to guess the syntax

Is it possible to use an ActionLink containing an element?

↘锁芯ラ 提交于 2019-11-30 22:48:06
问题 As the question says, Is it possible to use an ActionLink containing an element, and if not, what is the best way to achieve it? For example, lets say I have a Span element, I want the whole thing to be a hyperlink... The following works: <a href="/Site/Page/@Model.ID?Type=test"> <span class="box5">Click anywhere in this box</span> </a> Imagine that span/css class box5 makes this large... Was originally a DIV, but, I found that didn't follow standards and this appears to follow ok. This

Create a custom ActionLink

巧了我就是萌 提交于 2019-11-29 12:51:22
I want to create a custom actionlink but I don't know how to do this while fulfilling my needs. I worked with custom htmlhelpers before but this is a bit more tricky for me. The actionlink that I want to call needs to be like this: @Html.CustomActionLink("LinkText", "Area","Controller","TabMenu","Action",routeValues, htmlAttributes) so an example would be: @Html.CustomActionLink("Click here","Travel","Trip","Index","Index", new { par1 = "test", par2 = test2, new { @class = "font-color-blue" })` Which would generate this html: <a class="font-color-blue" href="/Trip/Travel/Index/Index?par1=test

ActionLink with multiple parameters

社会主义新天地 提交于 2019-11-28 19:11:27
I want to create a URL like /?name=Macbeth&year=2011 with my ActionLink which I have tried doing like so: <%= Html.ActionLink("View Details", "Details", "Performances", new { name = item.show }, new { year = item.year })%> but it doesn't work. How do I do this? The overload you are using makes the year value end up in the html attributes of the link (check your rendered source). The overload signature looks like this: MvcHtmlString HtmlHelper.ActionLink( string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes ) You need to put both your route values

How Can I Stop ASP.Net MVC Html.ActionLink From Using Existing Route Values?

↘锁芯ラ 提交于 2019-11-28 18:54:21
The website I'm working on has some fairly complicated routing structures and we're experiencing some difficulties working with the routing engine to build URLs the way we need them to be built. We have a search results page that uses RegEx based pattern matching to group several variables into a single route segment (i.e. "www.host.com/{structuralParameters}" can be the following: "www.host.com/variableA-variableB-variableC" - where variables A through C are all optional). This is working for us fine after a bit of work. The problem we are experiencing resolves around an annoying feature of

ActionLink back button

て烟熏妆下的殇ゞ 提交于 2019-11-28 09:37:28
问题 I have an Index method that does double duty as showing a list of posts and a queried list of posts and can also have pages so you get urls like /News/Page/1 or /News?query=test When a user clicks through to a post at say News/Details/1 they get a simple ActionLink that takes them back to the list. BUT I want this link to take them back to the actual page they were on in terms of the paging or the query. How could I do this? I don't want to use the JavaScript history method. Here is my