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

[Solved] GridDataItem and GridInsertDataItem

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dominic
Top achievements
Rank 2
Dominic asked on 27 Mar 2009, 02:04 PM

Hi

In my application i have a simple grid where i need to make some operations is in DisplayMode and some other actions if the grid is in EditMode so i simply use the condition below, but for a reason that i dont unserstand the code inside the condition is executed even if i try to insert a new item. When i check the type of e.item it is a GridDataInsertItem and not a GridDataItem  but the code inside the condition is still executed... I'm sure i'm missing something obvious but i cant figured out what it can be...

 Private Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
         
 
        If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then 
'the grid is EditMode  
            Dim Item As GridEditableItem = e.Item  
 
              
        End If 
 
        If TypeOf (e.Item) Is GridDataItem Then 
 
'the grid is not in editMode (DisplayMode)  
            Dim dataBoundItem As GridDataItem = e.Item  
'throw the conversion error because i dont have any ID yet  
            Dim ID As Integer = dataBoundItem("DbId").Text  
 
             
        End If 
 
    End Sub 

Thanks in advance for your help.

1 Answer, 1 is accepted

Sort by
0
Dominic
Top achievements
Rank 2
answered on 27 Mar 2009, 02:37 PM
Hi

Finally, the solution was really simple. For a reason that i dont understand, the EditMode property was set to InPlace...Maybe i changed it by error... So everything is fine.

Thanks
Tags
Grid
Asked by
Dominic
Top achievements
Rank 2
Answers by
Dominic
Top achievements
Rank 2
Share this question
or