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

[Solved] How to see previously inserted data in edit mode in RadGrid?

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Katarina
Top achievements
Rank 1
Katarina asked on 03 Apr 2009, 10:59 AM
I have RadGrid with GridTemplateColumns. In ItemTemplate it is label and in EditItemTemplate it is texbox. When grid goes in edit mode, I can't see prevoiusly inserted data (what was in label before I click on Edit button).
I tried with EditCommand, but when that event is fired -- that control is label ( I can put some data in it). But that control becomes texbox later -- and I dont know how to get that textbox: is there some other event for that? I can get that textbox in UpdateCommand but that's too late.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Apr 2009, 12:41 PM
Hi Katarina,

It is too early to access the Edit form in the EdiCommand event of the grid. Instead you can access the TextBox in the ItemDataBound event of the RadGrid as shown below.

CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
    { 
        GridDataItem dataItem = e.Item as GridDataItem; 
        TextBox textbox = (TextBox)dataItem.FindControl("TextBoxControlID");          
    } 

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