actionlink

Html not correct rendered and no Viewbag.Title is set using Ajax.ActionLinks

不想你离开。 提交于 2020-01-05 03:26:51
问题 _ViewStart.cshtml @{ Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml"; } _Layout.cshtml ... </head> <body> <div id="NavigationPanel"> @{ AjaxOptions options = new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "ContentPanel", OnBegin = "OnBeginAnimateContentPanel", OnComplete = "OnCompleteAnimateContentPanel", };} <div> <p>@Ajax.ActionLink("Users", "Index", "User", options)</p> <p>@Ajax.ActionLink("Groups", "Index", "Group", options)</p> <p>

Actionlink to child action

拟墨画扇 提交于 2020-01-04 03:13:23
问题 I have called a view from another with Html.Action method. I want to call the same action with a parameter Inside the child view, when user click the action link. When I write this code I get this error message: Html.ActionLink("link", "Configure", new { id = 2 }) The action 'Configure' is accessible only by a child request. How can i handle this issue? Edit: I'll try to reexplain the issue: my parent view is ConfigureMethod.cshtml. I call child child view like that: @Html.Action("Configure",

how to insert image in html action link? asp.net mvc

坚强是说给别人听的谎言 提交于 2020-01-03 08:50:14
问题 I have navigation and many link on my webproject from html action links. They are ugly with underline. I would like to insert some image with name or play with styles of action link. Is it possible? How to do that? Thanks and take care, Ragims 回答1: You could use css to remove the underlines or place a backgroundimage, otherwise you could also just create the link like so: <a href="<%: Url.Action("Action", "Controller")%>"><img src="yourimg.jpg" /></a> 回答2: Html.ActionLink and Url.Action

Passing parameters to MVC Ajax.ActionLink

岁酱吖の 提交于 2020-01-01 05:39:22
问题 How can I send the value of the TextBox as a parameter of the ActionLink? I need to use the Html.TextBoxFor <%= Html.TextBoxFor(m => m.SomeField)%> <%= Ajax.ActionLink("Link Text", "MyAction", "MyController", new { foo = "I need here the content of the textBox, I mean the 'SomeField' value"}, new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%> The Contoller/Actions looks like this: public class MyController{ public ActionResult MyAction(string foo) { /* return your content */ } } Using

Rewrite an asp.net mvc ajax actionlink as a jquery/ajax statement

北城余情 提交于 2019-12-30 11:21:11
问题 How would you rewrite this statement using Jquery + Ajax only? This code displays a link. When I click on it a view is returned into the StuffPanel id. @{ AjaxOptions options = new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "StuffPanel", OnBegin = "OnBeginWork", OnComplete = "OnCompleteWork", };} <p>@Ajax.ActionLink("show stuff", "Index", "Stuff", options)</p> 回答1: Here you go: <a href="/Index/Stuff" id="action">show stuff</a> $(function() { $('#action').click

ASP .NET MVC - Change domain used by URL.Action?

試著忘記壹切 提交于 2019-12-25 11:51:55
问题 I have a website that has two domains pointing to the same content. Let's call them www.domainA.com and www.domainB.com where www.domainA.com/Page is the same as www.domainB.com/Page. Every page on the site has a number of common navigation links (and others) that are constructed using a mixture of Url.Action and Html.ActionLink calls. The resulting urls are based on the current domain. Because www.domainA.com is the primary domain, I would like any links generated from www.domainB.com to be

MVC: Is that possible to Ajax.ActionLink with an image and the text on the right hand side with the image?

天大地大妈咪最大 提交于 2019-12-24 22:00:16
问题 I have created the following button based on Ajax.ActionLink logic: @Ajax.ActionLink("View Details", "Method", "Controller", new AjaxOptions { OnBegin = "showProgress", OnComplete = "showImage", OnFailure = "ReportError" }, new { @class = "modal-link k-button btn-icon-sm btn-view-detail k-icon k-i-file-txt", style = "width: 150px; height:70px;" }) That produces the following image with the Action Description and Action Image underneath: This is the html that represents the button: <a title=

permissions aware (icon) action links for all models: how?

给你一囗甜甜゛ 提交于 2019-12-24 20:17:04
问题 I have several models, for which I want to show some common icons for action links (new, details, edit, delete) and some specific ones for certain models only; these iconlinks must only be showed when the user has permission to perform the action. Permissions are decided by roles, but I'd like to abstract them, so that the explicit needed roles are written in one place only. I'd also like to use the same logic to show icons and to "protect" action methods, so that if Foo role used to be

Using a strongly typed ActionLink when the action method doesn't take a primitive type

血红的双手。 提交于 2019-12-24 16:33:41
问题 Does anyone know how I could go about doing something like : Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } )) This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of: public Controller : Controller { public ActionResult SomeMethod(MessageObject message) { // do something with the message return View(); } } I've written something similar for generating forms, but that doens't need to include the Id value on the end

How can I create this action link?

萝らか妹 提交于 2019-12-24 11:30:14
问题 I'm having issues creating an ActionLink using Preview 5. All the docs I can find describe the older generic version. I'm constructing links on a list of jobs on the page /jobs. Each job has a guid, and I'd like to construct a link to /jobs/details/{guid} so I can show details about the job. My jobs controller has an Index controller and a Details controller. The Details controller takes a guid. I've tried this <%= Html.ActionLink(job.Name, "Details", job.JobId); %> However, that gives me the