如何使用多个值反序列化json字符串 [英] How to deserialize the json string with multiple values

查看:89
本文介绍了如何使用多个值反序列化json字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"fares":["550.00","500.00"],





i希望在asp.net网格中显示最低价值





i want to display lowest value in asp.net grid

<asp:TemplateField Visible="true">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Bind("fares") %>' ID="Label25">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>





我的尝试:



i希望在asp.net grid中显示它



What I have tried:

i want to show it in asp.net grid

推荐答案

所以内联你很难在这里绑定最低值: -



在我看来,你可以尝试下面列出的两个想法:



1)放一个单独的计算属性,其中包含的值最低票价并将该字段绑定到标签文本。或者



2)去调用一个单独的方法,它将获取整个文本并返回最低票价,并且你可以内联绑定。



一些示例代码可能如下所示: -



So inline it will be difficult for you to bind the lowest value here:-

In my view you may try two ideas here as listed below:

1) Put a separate calculated property which will contain the value for lowest fares and bind that field to the label text. OR

2) Go for calling a separate method which will take the entire text and return you the lowest fare and which you can bind inline.

Some sample code might look like below:-

<asp:label id="Label1" runat="server" xmlns:asp="#unknown"><![CDATA[<%= GetMyText("comma separated fares") %></asp:label>







protected string GetMyText(string input)
        {
            string output = string.Empty;
            // calculate the lowest from the comma separated input value and store in variable "output"
            return output;
        }





希望这有助于提供一些提示。



Hope this will be of help to give some hint.


这篇关于如何使用多个值反序列化json字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆