actionlink

Adding Ajax.ActionLink to DataTable column while using server-side processing?

▼魔方 西西 提交于 2019-12-13 06:13:06
问题 Alright, so I was unable to find any posts with people trying to do this. I have an MVC4 razor view which contains a jQuery DataTable with a list of Vendor data. In the 1st column I have added 3 buttons: info/edit/delete, which open a partial view in a hidden div to the right of the table. I can do a foreach to loop through the model and write the table rows with Ajax Actionlinks and data columns for each item; this all works fine. My issue came about when I decided to use server-side

Passing Parameters from textboxes in a view to a controller in ASP.Net MVC2

∥☆過路亽.° 提交于 2019-12-13 05:22:06
问题 I am trying out ASP.Net MVC2 by building a small sample website which, amongst other features provides the user with a 'Contact Us' page. The idea is to allow a user to enter their name, email address, message subject and message. To send the message the user clicks on an ActionLink. This is the view: <% Html.BeginForm(); %> <div> <%: Html.Label("Name")%> <br /> <%: Html.TextBox("txtName", "",new { style = "width:100%" })%> <br /> <%: Html.Label("Email address")%> <br /> <%: Html.TextBox(

UrlEncode of link ids with ASP.NET MVC HtmlHelper extension methods

ぐ巨炮叔叔 提交于 2019-12-13 02:34:43
问题 I have actions that take string id parameters that are based on a username which can include characters that require encoding, for instance "user?1" If I use ActionLink() to generate the links, passing the string without encoding, it generates a link like this: http:\\localhost\controller\action\user?1 , and the action gets passed "user" as the id. If I UrlEncode() the string before passing it to ActionLink , then the link generated is: http:\\localhost\controller\action\user%253f1 as

RavenDB Ids and ASP.NET MVC3 Routes

笑着哭i 提交于 2019-12-12 07:44:25
问题 Just building a quick, simple site with MVC 3 RC2 and RavenDB to test some things out. I've been able to make a bunch of projects, but I'm curious as to how Html.ActionLink() handles a raven DB ID. My example: I have a Document called "reasons" (a reason for something, just text mostly), which has reason text and a list of links. I can add, remove, and do everything else fine via my repository. Below is the part of my razor view that lists each reason in a bulleted list, with an Edit link as

how to render actionlink to view form controller

北城以北 提交于 2019-12-12 06:13:29
问题 ViewBag.htmml = "<li>" + "Html.ActionLink(" + "Home" + ", " + "Dashboard" + ", " + "User" + ")" + "</li>"; Above is my code, using which I am trying render an ActioLink to my view. When the code runs, using the following code, I don't get an actionlink with name as Home, instead i get Html.ActionLink(Home, Dashboard, User) in my <li> part. How to get an ActionLink with what I am trying. @Html.Raw(ViewBag.htmml) 回答1: As @Stephen Muecke have mentioned, HTML needs to be generated in the View,

Dynamically create html action links using javascript variables on ASP.NET MVC3 razor

戏子无情 提交于 2019-12-12 04:36:08
问题 Say I have a javascript dictionary variable with the following key value pairs: var attributes = { name : "name1", age: 10} I want to use the values in the above attribute to create the children of an HTML ul element within the same javascript function as follows: var htmlContent = '<ul><li>@Html.ActionLink(attributes["name"], "Details", "Home", new { name = attributes["name"]})</li></ul>' Is there a way to do this? TIA. 回答1: I'm not sure you can use the JavaScript attributes variable in the

ASP.NET passing List back to controller from IEnumerable @model inside Table header ActionLink with non-indexing

自古美人都是妖i 提交于 2019-12-12 02:28:25
问题 I have been reviewing possible ways to return a View's @model information which is of type IEnumerable back to the controller, so that if I sort/filter on a query from database, I can refine the return each iteration without restarting with a fresh full list being returned. All the ways show you need to POST back based on model[index] which works if you are inside a for loop. But I am working with sending the collection back from an @HTML.ActionLink within a table's header section, so there

how to pass a parameter to actionlink from a script

旧城冷巷雨未停 提交于 2019-12-12 02:14:08
问题 I have a script: function FindSerial() { var textBoxValue = $("#clientSerial1").val(); return textBoxValue; }; My actionlink is : @Html.ActionLink("talks", "ClientTalks", "Talk", new { id ="FindSerial()" }, null) I want to use the function in order to get id ; how can it be done? 回答1: @Jalai Amini is right. You will need to handle it with jquery. Something like this: @Html.ActionLink("talks", "ClientTalks", "Talk", new { id="talklink"}) <script> $(function () { $('#talklink').click(function (

After a change to the default routing map my actionlinks stopped working

我只是一个虾纸丫 提交于 2019-12-12 01:02:43
问题 I made a change to my routing map which is following now: routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}/{title}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, title = UrlParameter.Optional } ); And this is the actionlinks that are not working anymore: @Html.ActionLink("Category", "CategoryList", "Category") When I click on this actionlink nothing happens the url stays the same http://localhost:62394/ as the page reloads. its so weird

How to get formcollection using ajax.actionlink

你说的曾经没有我的故事 提交于 2019-12-11 16:13:42
问题 I have a controller with the codes like this: [AcceptVerbs("POST")] public ActionResult Create(FormCollection collection) { //why is that the collection is null? } I am calling this action using the ajax.actionlink. my problem is the collection is null, unlike if i use the submit(input) button the formcollection has values. 回答1: FormCollection has a default binder associated with it which always initializes the collection and you should never get null . It is more likely that you have an