由于unicode字符'\',mvc3下拉列表无法正常工作

时间:2013-02-20 13:31:34

标签: c# asp.net-mvc-3 razor

我有以下代码,页面工作unil我提交它并尝试保存到db,我有字段作为nvarchar(70)。当我选择“基金/投资经理”时,由于'/'页面出现错误。我甚至尝试使用 HttpUtility.HtmlEncode(“基金 - 投资经理”,......),但这不起作用。有没有其他人提出过这个问题? 提前致谢 Hesh

@Html.DropDownListFor(
       model => model.JobDesc, 
       new SelectList(
              new List<Object>{ 
                   new { value = "Please Select" , text = "Please Select"  },
                   new { value = "Buy-Side Analyst" , text = "Buy-Side Analyst" },
                   new { value = "Fund/Investment Manager" , text = "Fund/Investment Manager"},
                   new { value = "Sell-Side Analyst" , text = "Sell-Side Analyst"},
                   new { value = "Broker" , text = "Broker"},
                   new { value = "Other" , text = "Other"}
                },
              "value",
              "text", new { @class = "chk" }
       )
    )

1 个答案:

答案 0 :(得分:0)

你试过逃避字符串吗?

基金//投资经理