This is a migrated thread and some comments may be shown as answers.

Can't get info from one of the row cells on edit mode

1 Answer 20 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mathias
Top achievements
Rank 1
Mathias asked on 01 Oct 2010, 03:54 AM
Hi ppl!

I'm driving crazy, I have a Grid, that when in edit mode, i need to get one cells data [Id for the row in the db], for making the RadListBox1_ItemDataBound, that is another cell in the table,where i make a list of items for another db table.
So, why I need that id? because I need to check which items from the RadList are relevant for that specific row.

I hope you can help me... I been hours fighting with this, and I can't find the way!

Please help me!

Greetings

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Oct 2010, 06:17 AM
Hello Mathias,

In ItemDataBound event check whether it is in edit mode and access the corresponding cell and get the data.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
  {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)//EditMode is 'InPlace' or 'PopUp'
      {
          GridEditFormItem editItem = (GridEditFormItem)e.Item;
          TextBox txtid = (TextBox)editItem["id"].Controls[0];
          string id = txtid.Text;
      }
  }

And please refer the following documentation for accessing cells and rows in a grid.
http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

Thanks,
Princy.
Tags
Grid
Asked by
Mathias
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or