Sunday, 8 September 2013

Radgrid get cell value when in edit mode

Radgrid get cell value when in edit mode

I have a radgrid and a textbox where I would like to show the value of a
column when the record is in edit mode. The value I would like to get is
contained in a readonly column and it is listed in DataKeyNames, it is
basically the transaction id given by the SQL database when the item is
created.
<MasterTableView CommandItemDisplay="TopAndBottom"
DataSourceID="SqlDataSource1" AutoGenerateColumns="False"
DataKeyNames="TransazioneID" AllowFilteringByColumn="True">
I cannot get it out.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem item = e.Item as GridEditableItem;
string str = item["TransazioneID"].Text;
TextBox1.Text = str;
The code doesn't give me errors but shows nothing. How can I get the value
of "TransactionID" for the record in edit mode?

No comments:

Post a Comment