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

radgrid edittemplate insert/edit modes

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bob
Top achievements
Rank 1
bob asked on 12 Jul 2011, 09:31 PM
I have a template set up and would like to access the linkbuttons on the edittemplate form and change their text based on the mode of the grid. If i'm inserting I want that row's linkbutton.text = "insert" and if that row is not inserting, but still in edit mode linkbutton.text = "Update". As an example, if you start to edit a row, then click "Add new record", you end up with 2 editable rows. One for inserting and one for editing... I want to distinguish between the two.
any examples or idea's on how to do this?

I know I can pull the commandname from itemCommand and check for InityInsertCommand and set a form level boolean, then check against that boolean in itemcreated..
    Protected Sub rgCurrent_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgCurrent.ItemCommand
        If e.CommandName = RadGrid.InitInsertCommandName Then
            inserting = True
        End If
    End Sub
 
    Protected Sub rgCurrent_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgCurrent.ItemCreated
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode and inserting Then
'This returns every editable row while in insert mode, but I want only the insert row
        End If
    End Sub

2 Answers, 1 is accepted

Sort by
0
Accepted
Elliott
Top achievements
Rank 2
answered on 12 Jul 2011, 09:40 PM
If TypeOf e.Item Is IGridInsertItem Then
ElseIf TypeOf e.Item Is GridDataItem Then
    dgItem = CType(e.Item, GridDataItem)
    FillInCheckBoxes(dgItem)
End If
this snippet of code is used for the edit item only - not the insert
0
bob
Top achievements
Rank 1
answered on 13 Jul 2011, 06:03 PM
Doh! Thanks for the quick response!
Tags
Grid
Asked by
bob
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
bob
Top achievements
Rank 1
Share this question
or