![](/img/trans.png)
[英]DataBinding: 'System.Xml.linq.XElement' does not contain a property with the name 'colorName'
[英]System.Xml.Linq.XElement' does not contain a definition for 'XPathEvaluate
我正在嘗試查詢通過模型數據傳遞的Xelement值,但出現以下錯誤
var hello1 = (string)this.Model.hello.XPathEvaluate("/hello/helloworld]");
web.config中的命名空間:
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Xml.Linq" />
<add namespace="System.Xml.XPath"/>
</namespaces>
我最終從配置文件中刪除了引用,並將其直接添加到頁面中,@ using System.Xml.Linq;。 @using System.Xml.XPath;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.