Nested Repeater question

  • Thread starter Thread starter Bojesphob
  • Start date Start date
B

Bojesphob

Can someone help? I
have a nested repeater in which I wish to format one of
the bits of data in currency. I know that the code for the
regular repeater (which works fine in parent) is
databinder.eval(Container.DataItem, "Net", "{0:c}") . BUT
I use that code in the nested repeater and IT DOES NOT
WORK!!!! In that code I have DataBinder.Eval
(Container.DataItem, "Reduction", "{0:c}") and the page
gives me the error "Error: System.Web.HttpException:
DataBinder.Eval: 'System.Data.DataRow' does not contain a
property with the name Reduction."
If I only use Container.DataItem("Reduction") it works
fine! I was told over on asp.net that the code I tried to
use it what I should use, and that it works fine for them,
but I cannot get it to work! I spelled everything
correctly, and as far as I know bound everything
correctly, but it still will not work! Does anyone have a
working example of a nested repeater with a formatted
column? I really need to get this fixed, I have other
projects which need to get done, but this takes priority,
Help!
 
Try this - - create a Function:
Function doFormat(sItem as Decimal) ' Here, you can use whatever datatype
you have assigned to the field
Dim s as String
s=String.Format("{0:c}", sItem)
doFormat=s
end function

Then, in your nested DataList - -
<%# doFormat(Container.DataItem("Reduction"))

David Wier
http://aspnet101.com
http://aspexpress.com
 
Back
Top