- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
想象一个定义如下的对象:
public class MyViewModel{
public List<string> MyList { get; set; }
}
在我看来,我有这个操作链接:
@Ajax.ActionLink("<", "Index", new MyViewModel() { MyList = new List<string>() {"foo", "bar"}}, new AjaxOptions())
ActionLink 的 html 结果将是:
<a class="btn btn-default" data-ajax="true" href="/Index?MyList=System.Collections.Generic.List%601%5BSystem.String%5D"><</a>
我的问题是,如何得到这个结果:
<a class="btn btn-default" data-ajax="true" href="/Index?MyList=foo&MyList=bar"><</a>
最佳答案
你可以试试string.Join。像这样的东西
@Ajax.ActionLink(
"Your text", -- <
"ActionName", -- Index
new
{
MyList =string.Join(",", new List<string>() {"foo", "bar"}),
otherPropertiesIfyouwant = YourValue
}, -- rounteValues
new AjaxOptions { UpdateTargetId = "..." }, -- Your Ajax option --optional
new { @id = "back" } -- Your html attribute - optional
)
关于c# - 在 ActionLink 的 RouteValues 中传递 IEnumerable 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46304796/
在我的 ASP.NET MVC 4 应用程序中,我可以过滤多个标签。在 HTML 中,它看起来像这样: One Two Three
我有一个 ActionLink 链接 @Ajax.ActionLink("Delete it!", "Delete", new {id = getTheID}, new AjaxOptions { C
我有一个包含以下 javascript 的部分页面: var url = '@Url.Action("Details", "Users", null)/' + userID; 除了具有 url 结构的
Request 和 RouteData.Values 中的 QueryString 有什么区别? 我们可以改用它们吗? 最佳答案 RouteValues 只有在 global.asax 中定义时才会从
我有一个名为“UserProfile”的区域。 从索引 View 中,我想从根 Controller (非区域)调用一个 Action 。 我使用了Html.ActionLink(“Index”,“H
所以我有一个 Url Action Create new teacher & assign to account. 传入两个路由值:createAndAssign 和 teacherID。 现在当我转
所以我有一个 Url Action Create new teacher & assign to account. 传入两个路由值:createAndAssign 和 teacherID。 现在当我转
将日期时间参数传递给 RedirectToAction 时 (Asp.Net MVC2)通过传递 DateTime 或传递日期:“13/4/2000” return RedirectToAct
我正在做以下工作: 1- 用户在文本框中输入一个值。 2- 然后点击编辑进入编辑 View 。 这是我的代码: 问题是我不知道如何从 textBox 中获取值并将其传递给 Actio
我有一个通用方法,它根据当前 Controller 、当前操作和当前可选参数(如果有)生成链接结构。 public static string GetLink(this HtmlHelper help
因此,如果我在第一个 Controller 中执行此操作: public class AController:Controller { public ActionR
在我的操作方法助手中使用它之前,我希望能够选择将哪些属性添加到我的对象中。所以我使用了一个 ExpandoObject 来实现这一点。 dynamic routeValues = new Expand
我有一个编码问题,我似乎无法掌握有关路线参数的问题。基本上,它要么从不 URL 编码,要么加倍 URL 编码。我只想对它进行单一编码! 这是我注册的路线: routes.MapRoute("Scan"
想象一个定义如下的对象: public class MyViewModel{ public List MyList { get; set; } } 在我看来,我有这个操作链接: @Ajax.A
HTML 助手 @Html.Pager来自 MvcPaging 2.0. 有 .Options(o => o.RouteValues(object RouteValues))它可以将 Model 返回
@{ ViewBag.Title = "About Us"; } @using (Html.BeginForm(new RouteValueDictionary { {"Action","In
我有一个疑问是: 当我使用下面的代码时: @(Html.ActionLink("Click Me", "ACTION", new {QueryName = ViewBag.QueryName})) 我
我的 View 如下所示: " %> 我的 Controller Action : public ActionResult S
假设我们有一个页面包含一些支持从数据库搜索的元素,那么在 Post Action 中我们需要找到哪些元素是事件的,并根据该创建路由值,如下所示: List SearchParameters = Get
当通过 RouteValueDicitonary或匿名对象到 @Url.Action 方法(或其任何类似物)中,有没有办法正确传递集合对象或 IEnumerable以便它生成一个与默认模型绑定(bin
我是一名优秀的程序员,十分优秀!