[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to format currency and Date in Datagrid and ListView control

Posted on 2006-04-11
5
Medium Priority
?
2,390 Views
Last Modified: 2008-03-10
I am doing a project in Vb.net . It is somewhat different for me as i am a vb programmer. some of the issues like formatting currency and date in Datagrid, Datalist and especially Listview control . can any one tell me how to do this format with a code sample. it will be very helpful for me.
0
Comment
Question by:rahaman
  • 2
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 80 total points
ID: 16438751
Here is a DataGrid example:

<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 44px; POSITION: absolute; TOP: 60px" runat="server" Width="492px" Height="192px" AutoGenerateColumns="False">
  <AlternatingItemStyle CssClass="alternatingstyle">
  </AlternatingItemStyle>
  <ItemStyle CssClass="itemstyle">
  </ItemStyle>
  <HeaderStyle CssClass="headerstyle">
  </HeaderStyle>
  <Columns>
    <asp:BoundColumn DataField="name" HeaderText="Name"></asp:BoundColumn>
    <asp:BoundColumn DataField="address" HeaderText="Address"></asp:BoundColumn>
    <asp:BoundColumn DataField="current_date" HeaderText="Current Date" DataFormatString="{0:dd MMM yyyy}"></asp:BoundColumn>
    <asp:BoundColumn DataField="amount_due" HeaderText="Amount Due" DataFormatString="{0:C}"></asp:BoundColumn>
  </Columns>
</asp:DataGrid>

Look at the BoundColumn declarations, and the DataFormatString formats:

Data Examples:
(1) {0:dd MMM yyyy} = 12 Apr 2006
(2) {0:C} = $1268.60

You can specify these values through the 'Property Builder' for the DataGrid.

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16650606
:)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question