如何在DataRepeater中使用formar数据(日期,金钱) [英] how to formar data (date, money) in a DataRepeater

查看:72
本文介绍了如何在DataRepeater中使用formar数据(日期,金钱)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB.net中使用DataRepeater,使用Price,Date等数据....问题是我无法在表单中格式化这些数据....我想显示日期,如dd / MMM / yyyy和Money如$ x,xxx.xx

解决方案

x,xxx.xx


你将会有在转发器中绑定它们时格式化值。

这样的事情:(假设你的数据集中有一个MinPrice& SaleDate列。)



 <   asp:label     id   =  Label1    runat   =  server    text   ='  <% String  .Format(  {0:C},Eval(  MinPrice))%>' >  <   / asp:label  >  
< asp:label id = Label2 runat = server text =' <% String .Format( {0:d},Eval( SaleDate))%>' > < / asp:label >


这是解决方案



tFechaComp.Value = CDate(dataset.Tables(0).Rows(0).Item(FechaCompra ).ToString)

tCST.Text = FormatCurrency(dataset.Tables(0).Rows(0).Item(CST)。ToString,2)


Im using a DataRepeater in VB.net, with data like Price, Date.... the problem is that i can''t format these data in the form.... i want to show the Date like dd/MMM/yyyy and Money like $x,xxx.xx

解决方案

x,xxx.xx


You are going to have to format the values when you bind them in your repeater.
So something like this: (Assuming you have a MinPrice & SaleDate column in your dataset.)

<asp:label id="Label1" runat="server" text='<%# String.Format("{0:C}", Eval("MinPrice")) %>'></asp:label>
<asp:label id="Label2" runat="server" text='<%# String.Format("{0:d}", Eval("SaleDate")) %>'></asp:label>


this is the Solution

tFechaComp.Value = CDate(dataset.Tables(0).Rows(0).Item("FechaCompra").ToString)
tCST.Text = FormatCurrency(dataset.Tables(0).Rows(0).Item("CST").ToString, 2)


这篇关于如何在DataRepeater中使用formar数据(日期,金钱)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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