datagrid alternative?

  • Thread starter Thread starter duncfair
  • Start date Start date
D

duncfair

I need to create code to deploy Google Analytics e-commerce.

The item data needs to be formatted like so:


pageTracker._addItem(
"3333", // OrderID
"929392939392 ", // SKU
"Widget ", // ProductName
"Fuschia ", // ColortName
"109.95", // Price
"1" // Quantity
);

I can't use a datagrid because I can't have any of the formatting in
there, but I need the 'pageTracker._addItem( '
and the closing ');' for each item on my receipt page.

How can I do this?
 
Thanks.

Well, the site is written in c# and is .net 2.0, so I guess it's both.

The kind of data I asked about already goes to a datagrid on the
thankyou.aspx page, but I need it to go into a javascript function (as
shown) as well.

Thanks again,
 
duncfair said:
The kind of data I asked about already goes to a datagrid on the
thankyou.aspx page, but I need it to go into a javascript function (as
shown) as well.

Can't you store your data in a DataTable, then use that as a binding
source for the DataGrid and also pull any data you need to use elsewhere
out of it?
 
I don't think I can use a datagrid because I cannot have any of the
formatting code associated with a datagrid. The example shows what
would appear on the page if the user were to 'view source'. Otherwise,
this data is not vibile on the page.
 
what do you mean by "formatting code"? You can format a grid even if you
create a datatable and bind the dt to it.



I don't think I can use a datagrid because I cannot have any of the
formatting code associated with a datagrid. The example shows what
would appear on the page if the user were to 'view source'. Otherwise,
this data is not vibile on the page.
 
duncfair said:
I don't think I can use a datagrid because I cannot have any of the
formatting code associated with a datagrid. The example shows what
would appear on the page if the user were to 'view source'. Otherwise,
this data is not vibile on the page.

DataTables don't have any formatting, they're not controls, they're data
objects which allow you to store and access data in a table like manner,
ie by column and row.

If you want to display what's in them you either bind them a control
which accepts a binding source or you can do something yourself, such as
iterate over the collection of rows using a foreach.
 
yeah and you can also format the data for the control as well.

Currently I'm using a datatable that is binding to a gridview, for each row
within my datatable, I'm formatting it so it shows as a percent, dollar or
number. and I'm doing that prior to even binding my gridview because I have
no 2 rows that are the same format.
 
Back
Top