Hi,
Hi,
do this:
object o = rowData["totalamount"] ;
Decimal d = (Decimal)o;
put a breakpoint in the latter, and add o in the watch, see the type being
reported.
you could do a similar thing with rowData = (DataRowView)(e.Item.DataItem);
as you did not post where you bind the data, I cannot be sure the casting is
working fine (should be though ).
cheers
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
".Net Sports" <ba********@cox.net> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Nicholas, I get a object 'rowData' doesnt have an indexer error when
looking at this in the debugger watch window.
here is the coding for the rowData (the formatting in this reply
message may be slightly off):
private void dglvboard_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
DataRowView rowData;
Decimal price;
Decimal newssum;
System.Web.UI.WebControls.Literal totalamountLabel = null;
System.Web.UI.WebControls.Literal NewsLabel = null;
System.Web.UI.WebControls.Literal totalLabel = null;
System.Web.UI.WebControls.Literal newstotalLabel = null;
// check the type of item that was databound and only take action if
it
// was a row in the datagrid
switch (e.Item.ItemType)
{
case ListItemType.AlternatingItem:
case ListItemType.EditItem:
case ListItemType.Item:
case ListItemType.SelectedItem:
// get the data for the item being bound
rowData = (DataRowView)(e.Item.DataItem);
// get the value for the list price and add it to the sum
// get the control used to display the list price
// NOTE: This can be done by using the FindControl method of the
// passed item because ItemTemplates were used and the anchor
// controls in the templates where given IDs. If a standard
// BoundColumn was used, the data would have to be accessed
// using the cellscollection (e.g.
e.Item.Cells(1).controls(1)
// would access the label control in this example.
// now format the list price in currency format
// get the value for the discounted price and add it to the sum
price = (Decimal)(rowData["totalamount"]);