从字段中获取名称/值在Sitecore 7中键入“名称查找值列表”

时间:2014-11-11 08:58:06

标签: asp.net-mvc-3 sitecore sitecore7 namevaluecollection sitecore7.1

我正在使用Sitecore 7.1。我使用了一个字段类型"名称查找值列表" 。我希望在MVC中代码后面的字段类型中存储catch名称/值。如何捕获键值项。

1 个答案:

答案 0 :(得分:8)

string keyValueRawValue = item["NameValueListFieldName"];
NameValueCollection nameValueCollection = Sitecore.Web.WebUtil.ParseUrlParameters(keyValueRawValue );

foreach (string key in nameValueCollection ) 
{
      var value = nv[key];
}