c# – 使用data-url html属性的匿名类型成员声明符无效

栏目: ASP.NET · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/26920431/invalid-anonymous-type-member-declarator-using-data-url-html-attribute

我正在使用jQuery创建一个小项目,使用Razon和C#创建MVC4.在我看来,我有一个下拉列表,我希望给它data-url = Url.Action(“UpdateDeliveryAddress”,“Home”)的属性:

<div class="@dropDownListClass">
    @Html.DropDownList("theList", null, new {data-url=Url.Action("UpdateDeliveryAddress", "Home") })
</div>

但是,当我这样做时,我收到以下错误:

invalid anonymous type member declarator anonymous type members must be declared with a member assignemnt, simple name or member access.

我错过了什么?为什么我有这个错误?

data-url不是有效的C#标识符.

而是使用data_url.

MVC将用 – 替换_.

翻译自:https://stackoverflow.com/questions/26920431/invalid-anonymous-type-member-declarator-using-data-url-html-attribute


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Distributed Systems

Distributed Systems

Sukumar Ghosh / Chapman and Hall/CRC / 2014-7-14 / USD 119.95

Distributed Systems: An Algorithmic Approach, Second Edition provides a balanced and straightforward treatment of the underlying theory and practical applications of distributed computing. As in the p......一起来看看 《Distributed Systems》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试