473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to show monetary values in a DataGrid

Hello folks. I have a DataGrid in a Web Form. I´d like to show numeric
columns in Money format US$ 10,000.98. However, when I fill the DataGrid
from a SqlCommand, it fill in the DataGrid like this: 1000098. How do I do
that?

Thanks
Nov 17 '05 #1
4 4396
FormatNumber()

"Henrique Berenguel" <hb********@coimex.com.br> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello folks. I have a DataGrid in a Web Form. I´d like to show numeric
columns in Money format US$ 10,000.98. However, when I fill the DataGrid
from a SqlCommand, it fill in the DataGrid like this: 1000098. How do I do
that?

Thanks

Nov 17 '05 #2
But do you have a sample to show to me?
"Vaibhav" <co************@yahoo.com> escreveu na mensagem
news:Od**************@TK2MSFTNGP10.phx.gbl...
FormatNumber()

"Henrique Berenguel" <hb********@coimex.com.br> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello folks. I have a DataGrid in a Web Form. I´d like to show numeric
columns in Money format US$ 10,000.98. However, when I fill the DataGrid
from a SqlCommand, it fill in the DataGrid like this: 1000098. How do I do that?

Thanks


Nov 17 '05 #3
Specify the DataFormatString for your bound column..

<asp:BoundColumn HeaderText="MoneyMoney" DataField="Price" DataFormatString
= {0:c} />

--
Naveen K Kohli
http://www.netomatix.com
"Henrique Berenguel" <hb********@coimex.com.br> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello folks. I have a DataGrid in a Web Form. I´d like to show numeric
columns in Money format US$ 10,000.98. However, when I fill the DataGrid
from a SqlCommand, it fill in the DataGrid like this: 1000098. How do I do
that?

Thanks

Nov 17 '05 #4
The problem is that I´m using the option:

'Create columns automatically at run time' in the Property Builder of my
DataGrid.

Then I don´t have bound columns in the html, that´s the problem...

Look the code:

<asp:datagrid id="DataGrid1" runat="server" BackColor="White"
Width="692px" BorderColor="#999999" PageSize="3" AllowPaging="True"
BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical"
Height="94px">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#008A8C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemStyle ForeColor="Black" BackColor="#EEEEEE"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#000084"></HeaderStyle>
<FooterStyle ForeColor="Black" BackColor="#CCCCCC"></FooterStyle>
<Columns><asp:ButtonColumn Text="Selecionar"
CommandName="Select"></asp:ButtonColumn></Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999"
Mode="NumericPages"></PagerStyle>
</asp:datagrid>

Is there an other way to do that?

Or will I have to reprogram everything to recreate the browser with bounds
columns?

Thanks in advance

"Henrique Berenguel" <hb********@coimex.com.br> escreveu na mensagem
news:uz**************@TK2MSFTNGP11.phx.gbl...
But do you have a sample to show to me?
"Vaibhav" <co************@yahoo.com> escreveu na mensagem
news:Od**************@TK2MSFTNGP10.phx.gbl...
FormatNumber()

"Henrique Berenguel" <hb********@coimex.com.br> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hello folks. I have a DataGrid in a Web Form. I´d like to show numeric
columns in Money format US$ 10,000.98. However, when I fill the DataGrid from a SqlCommand, it fill in the DataGrid like this: 1000098. How do
I
do that?

Thanks



Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Derek | last post by:
Another DGrid question... I can not access the values of a cell in a datagrid unless I make them visible. I do not want these fields displayed. I only want to use the values to run a stored...
14
by: wane | last post by:
Hello, I have heard that one should avoid using float and double in monetary calculation because of the lack of preciseness. What is a good alternative? Thanks
4
by: Vik | last post by:
How can I display the lookup values in a datagrid? E.g., the datagrid displays a table that contains a ProductID field. I want to display a Product description from a Product table in that...
1
by: Randall Parker | last post by:
Title says it all. Using ASP.Net v1.1. Want to show some message when there are no records to show in a grid. Does one do that with the DataGrid control itself? Or in CodeBehind should one...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
2
by: Rares Vernica | last post by:
Hi, Can I use locale to format monetary values? If yes, how? If no, is there something I can use? E.g., I have 10000 and I want to get "$10,000". Thanks, Ray
130
by: Daniel Manes | last post by:
I'm baffled. I have a column in a SQL Server Express database called "Longitude," which is a float. When I view the table in a DataGridView, some of the numbers, which only have two decimal places...
6
by: Java1963 | last post by:
Need help with writting an application that prompt for and read a double value representing a monetary amount. -------------------------------------------------------------------------------- ...
1
by: simonyong | last post by:
hello, everyone Sorry for disturb.. im newbie to asp.net im trying to do a task that as below: In a SAME datagrid, it ll show all data when user key in key word in textbox... datagrid will...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.