datagrid data not there, but shows up in webpage

N

Narshe

I have a datagrid that gets bound, and on itemdatabound, there is no
data. If I look at datagrid.items, there is no data in the items
either. When the page is displayed, the datagrid has all the data in
it.

What might be causing this?
 
N

Narshe

I've figured one thing out. It works if the columns are BoundColumns,
but if they are ItemTemplates, this doesn't work.

How do I get row data out of rows that are item templates?
 
G

Guest

In datagrid_ItemDataBound event you can get data from e.Item.ItemData. For
example, if you use DataView, DataTable, or DataSet, as data source, you can
cast e.Item.ItemData to DataRowView object then retrieve each data in the
DataRowView:

DataRowView drv = (DataRowView)e.Item.ItemData;
string desc = drv[“descâ€].ToString();


HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top