Capturing the content of a DataGrid Cell???

  • Thread starter Thread starter thomaz
  • Start date Start date
If you wanted to get those contents when binding, you can use the
ItemDataBound event of the datagrid. One of the arguments is a
DataGridItemEventArgs which we will refer to as "e". Using this you
can reference a cell (0-based index) with the following:


e.Item.Cells[0].Text (with asp:BoundColumn)


or for a control inside of a template column:


((TextBox) e.Item.Cells[0].FindControl("txtStuff")).Text


If you want to do this at another time when you are not binding, then
replace "e" with the datagrid object name and that should do the trick.


Let me know if this helps you.
Thanks,
Ian Suttle
http://www.IanSuttle.com
 
Back
Top