knockout.js和asp.net字典
我正在尝试访问下面转换为json的字典的密钥。value1是dictionary的值,但是如何获取键呢?JSON显示了一个细节对象,如果有意义的话,属性就是键。那么如何在jquery模板中呈现该属性中的键名呢knockout.js和asp.net字典,asp.net,dictionary,knockout.js,Asp.net,Dictionary,Knockout.js,我正在尝试访问下面转换为json的字典的密钥。value1是dictionary的值,但是如何获取键呢?JSON显示了一个细节对象,如果有意义的话,属性就是键。那么如何在jquery模板中呈现该属性中的键名呢 {{each(index, value) $data}} <div class="flaw"> <div class="Title" data-bind="click: app.viewModel.caseStudy.showFlawDet
{{each(index, value) $data}}
<div class="flaw">
<div class="Title" data-bind="click: app.viewModel.caseStudy.showFlawDetails(index)"> ${value.Title} </div>
<div class="Items">
{{each(index1, value1) value.Details}}
<div>${value.Details[index1]}: <input type="text" data-bind="value: value1" /></div>
{{/each}}
</div>
</div>
{{/each}}
{{每个(索引、值)$data}
${value.Title}
{{each(index1,value1)value.Details}
${value.Details[index1]}:
{{/每个}}
{{/每个}}
我使用了一个对象数组。对象[]
public object[] Details { get; set; }
Details = (from e in f.Elements()
select new
{
Key = e.Name.ToString(),
Value = GetValue(e)
}).ToArray(),
<script id="flawTemplate" type="text/html">
{{each(index, value) $data}}
<div class="flaw">
<div class="Title" data-bind="click: app.viewModel.caseStudy.showFlawDetails(index)"> ${value.Title} </div>
<div class="Items">
{{each(index1, value1) value.Details}}
<div>${value1.Key}: <input type="text" data-bind="value: value1.Value" /></div>
{{/each}}
</div>
</div>
{{/each}}
</script>
public object[]详细信息{get;set;}
详细信息=(来自f.Elements()中的e)
选择新的
{
Key=e.Name.ToString(),
Value=GetValue(e)
}).ToArray(),
{{each(索引、值)$data}
${value.Title}
{{each(index1,value1)value.Details}
${value1.Key}:
{{/每个}}
{{/每个}}