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

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

内容简介:翻译自: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


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

查看所有标签

猜你喜欢:

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

The Definitive Guide to HTML5 WebSocket

The Definitive Guide to HTML5 WebSocket

Vanessa Wang、Frank Salim、Peter Moskovits / Apress / 2013-3 / USD 26.30

The browser is, hands down, the most popular and ubiquitous deployment platform available to us today: virtually every computer, smartphone, tablet, and just about every other form factor imaginable c......一起来看看 《The Definitive Guide to HTML5 WebSocket》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具