Solved

Formatting an ASP Repeater Container Data Item

Posted on 2004-04-26
6
380 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

778 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