Solved

Formatting an ASP Repeater Container Data Item

Posted on 2004-04-26
6
384 Views
Last Modified: 2012-06-21
I have a repeater that is loaded with a sql data reader in my start page. One of the fields I need is the price of the product and when I use the repeater, I can only access the data via <%#Container.DataItem("dblBasePrice") %>

 Is there a tag in ASP that I can put between the container.dataitem to format the number as currency?

Thanks,
LR
0
Comment
Question by:Luis_Romero
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
chaniewskim earned 125 total points
ID: 10921557
You can use syntax

<%# DataBinder.Eval(Container.DataItem, "dblBasePrice", "{0:C}") %>
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 10921586
You could do either of these:

<%# DataBinder.Eval(Container.DataItem, "dblBasePrice", "{0:c}") %>

or this (faster):

<%# String.Format("{0:c}", ((DataRowView) Container.DataItem)["dblBasePrice"]) %>

Good Luck,
Steve
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 10921601
Right behind you again chaniewskim.

Can you wait 5 minutes before you post the next time? :)
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:chaniewskim
ID: 10921654
Steve,
I'll try ;)
0
 

Author Comment

by:Luis_Romero
ID: 10922267
Thank you both for your help.

Where can I find more information on the DataBinder.Val method? as well as for the DataRow View method?

Thanks,
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 10922286
You can find help on these subject by going to:

http://www.msdn.microsoft.com/

And typing them in Search MSDN for.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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