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

GridEditFormItem?

1 Answer 205 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris May
Top achievements
Rank 1
Chris May asked on 27 Jan 2011, 04:35 AM
I was trying to write some code to resize the textbox for a item in a radgrid that is using a datasource, using the ItemDataBound event.  But when I click the button to edit the row the e.Item is never of type GridEditFormItem.  It's always a GridDataItem even when e.ItemIsInEditMode is true.
Protected Sub myRadGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemDataBound
    If ((TypeOf (e.Item) Is GridEditFormItem) And (e.Item.IsInEditMode)) Then
 
        '*** this will never be reached.
 
    End If
 
End Sub

As I mentioned, this event is properly fired when I begin to edit the row, and e.item.IsInEditMode is true for some of the items that are databound, but e.Item is always a GridDataItem.

Am I doing something wrong?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jan 2011, 05:45 AM
Hello Chiris,

I guess you are using Inplace EditMode. When InPlace editing is applied, the grid row is of type GridDataItem in regular mode and  GridEditableItem in edit regime. Hence you can cast the item according to its current mode:

Here is a sample code:

C#:
if ((((e.Item) is GridEditableItem) & (e.Item.IsInEditMode)))//EditMode="InPlace"
       {
 
           //*** your code
 
       }

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