How to format for Currency and Percnetage when Templates are used
What is the best practice to format numerics in a grid cell when a style template is used ?
Format = "P2" and Format = "C2" don't work once a color style is applied.
Attachment: Template_b703542b.zip
SIGN IN To post a reply.
4 Replies
MS
Monisha Saravanan
Syncfusion Team
February 4, 2022 08:53 AM UTC
Hi Greg,
Greetings from Syncfusion support.
We had modified your sample as per your requirement. We suggest you to convert the required data to ToString(“P2”) or ToString(“C2”) as per your requirement on the template as mentioned. Kindly refer the attached code snippet and sample for your reference.
|
<SfGrid DataSource="@Orders" AllowPaging="true">
<GridColumns>
<Template>
@{
var changeData = (context as Share);
if (changeData.Change > 0)
{
<span class="up"> @changeData.Change.ToString("P2")</span>
}
else
{
if (changeData.Change < 0)
{
<span class="down"> @changeData.Change.ToString("P2")</span>
}
else
{
@changeData.Change
}
}
}
</Template>
</GridColumn>
</GridColumns>
</SfGrid> |
|
|
Kindly get back to us if you have further queries.
Regards,
Monisha
GR
Greg
February 4, 2022 04:45 PM UTC
Thanks very much !
MS
Monisha Saravanan
Syncfusion Team
February 7, 2022 04:19 AM UTC
Hi Greg,
Thanks for the update.
We are glad to hear that your query has been resolved. Please get back to us if you need further assistance.
Regards,
Monisha
BY
Benjamin Young
November 14, 2022 06:37 AM UTC
Thanks for this information. I want to establish a business in investment, but I don't know much about it. I also need a business plan to launch this venture, so I went online to hunt for one and found the resource totimes.ca/how-to-write-a-business-plan-for-investors/, which can help me writing a business plan for investors.
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
GR Greg
- Feb 3, 2022 08:15 PM UTC
- Nov 14, 2022 06:37 AM UTC