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

Multiple templates for different item commands?

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saad
Top achievements
Rank 1
Saad asked on 04 Jan 2009, 10:47 AM
Hi,
i just need to have more than one templates in my radGrid. I have made a context menu which will be shown on right click over each row. Context menu have three options, delete, forward and noteback. I just want three different kinds of editing mode or template columns for each of the option which will have different controls.
Please guide me in it.....
And it would be better if the process of showing these templates will be at client side. 
Thank you!

1 Answer, 1 is accepted

Sort by
0
Phil
Top achievements
Rank 2
answered on 04 Jan 2009, 07:26 PM
This might be a start, I have supplied a lot more than telerik:

http://www.telerik.com/help/aspnet/grid/grddifferenteditformsoneditandinsert.html

Protected Sub RagGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RagGrid1.ItemCommand
    If (e.CommandName = RadGrid.InitInsertCommandName) Then
        e.Canceled = True
        RagGrid1.EditIndexes.Clear()
        e.Item.OwnerTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "~/uc/InvoiceAdd.ascx"
        e.Item.OwnerTableView.InsertItem()
        Dim _insertItem As GridEditableItem = e.Item.OwnerTableView.GetInsertItem()
        If Not _insertItem Is Nothing Then
            Dim _addControl As UserControl = CType(_insertItem.FindControl(GridEditFormInsertItem.EditFormUserControlID), UserControl)
            If Not _addControl Is Nothing Then
                CType(_addControl, IAdd).Clear() ' need to bind, using interface
            End If
        End If
    ElseIf (e.CommandName = RadGrid.EditCommandName) Then
        e.Item.OwnerTableView.EditFormSettings.EditFormType = GridEditFormType.AutoGenerated
        e.Item.OwnerTableView.IsItemInserted = False
    End If
End Sub

to convert to C# use http://converter.telerik.com/

Good luck Saadi

Tags
Grid
Asked by
Saad
Top achievements
Rank 1
Answers by
Phil
Top achievements
Rank 2
Share this question
or