Formatting output for template columns

zhaozj2021-02-16  57

Recently I study ASP.NET, I found that it can be done when outputting the template column. Sometimes you have to format the output of some of the outputs of the template, such as

Quarterp & l StatementQ1 2001

Revenue: 450391000Profit: 102200111Q2 2001

Revenue: 391000profit: -154950q3 2001

REVENUE: -150938000profit: -902200

In this table, if you want to have a negative number, you can do this, you can do this:

Revenue: <% # Makenegred (Container.eval (Container.DataItem, "REVENUE "))%>
profit: <% # Makenegred (dataBinder.eval .DataItem, "Profit"))%>

Where Makenegred is a function, you can write, return HTML.

Function Makenegred (Input As String) AS String 'See iF the Number IS Less Than 0 if Int32.Parse (Input) <0 Then Return " "& input &" " Else Return INPUT End If End Function Haha, this will reach effect.

转载请注明原文地址:https://www.9cbs.com/read-19817.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.029, SQL: 9