Settings values in DataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to know how I set an (C# code behind) variable with an selected item
into datagrid in a itemtemplate column. I can delete, redirect, select, but I
can assing values to any variable...

I apreciatte any help to do this
Ronald Morales
 
Hi Ronald:

One way to do this is catch the ItemDataBound event. In this event the
sender parameter is a DataGridItem, and DataGridItem contains all of
the controls you defined in the ItemTemplate. You can call FindControl
on the item and pass the name of your control, which should give you a
reference to the control so you can modify it programmatically. Of
course you'll need to do some type casting along the way.

Maybe my article here could help:
http://odetocode.com/Articles/116.aspx

This gives several examples of extracting values, it's easy to figure
out how to change that to setting values!
 
Back
Top