Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.60/5 (2 votes)
See more:
"fares":["550.00","500.00"],


i want to display lowest value in asp.net grid

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


What I have tried:

i want to show it in asp.net grid
Posted
Updated 7-Jul-16 2:28am
v2
Comments
F-ES Sitecore 7-Jul-16 6:33am    
This is not a code-on-demand website where other people do your work for you. Google "parse json c#" and you'll find lots of examples. If you get stuck then feel free to ask a specific question about a specific problem.

1 solution

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.NET
<asp:label id="Label1" runat="server" xmlns:asp="#unknown"><![CDATA[<%= GetMyText("comma separated fares") %></asp:label>


C#
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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900