错误名称'标识符'在当前上下文中不存在

时间:2015-12-30 12:19:02

标签: javascript c# jquery

我有C#枚举

public enum Item
{
    Identifier = 0,
    Title = 1,
    StartOfMedia = 2,
    Duration = 3,
    Content = 4,
    EOM = 5,
    FirstAirDate = 6,
    BoxId = 7,
    Seg = 8,
}

使用枚举的JavaScript代码

<script type="text/javascript">
    function updateFieldStatus() {}
    var Identifier = "";
    Identifier = @Item.Identifier.ToString();
    $(document).ready(function () {
            $("#Configuration").validate({
                rules: {
                    "config.Format["@Identifier"].StartPos":
            {
                required: true,
                digits: true,
                range: [1, 200]
            }, },
            }); 
    });
</script>

但我有错误:

  

&#34;名称&#39;标识符&#39;在当前上下文中不存在&#34;

我做错了什么?

1 个答案:

答案 0 :(得分:0)

尝试:

  "config.Format["+Identifier+"].StartPos":