Solved

Formatting an ASP Repeater Container Data Item

Posted on 2004-04-26
6
387 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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…

726 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