Telerik ASP.NET Grid Batch Edit Mode Dropdown Column

Overview

When a RadGrid is running in Batch Edit mode, the standard GridDropDownColumn often doesn’t behave correctly — especially when you need full control over how the dropdown is populated or when the editor must bind dynamically. To avoid those limitations, the most reliable approach is to switch to a GridTemplateColumn and embed a RadDropDownList inside the edit template.

Template Column Markup

The markup below replaces the built-in dropdown column with a template column that displays the raw value during normal mode and a fully functional RadDropDownList during edit mode. This gives you complete control over binding, sizing, and behavior.

<telerik:GridTemplateColumn HeaderText="Yard" UniqueName="locncode"  DataField="locncode">
    <ItemTemplate>
        <%# Eval("locncode") %>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadDropDownList runat="server" ID="locncode" Width="50px" DropDownWidth="50px" DataTextField="locncode" DataValueField="locncode"></telerik:RadDropDownList>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

Populating the Dropdown

Because Batch Edit mode uses a different editing pipeline, the dropdown must be populated inside the grid’s PreRender event. Here we grab the batch editor for the column, locate the dropdown, and bind it to the yard-operations lookup table.

Private Sub RadGrid1_PreRender(sender As Object, e As EventArgs) Handles RadGrid1.PreRender
    Dim strError As String = ""
    Try
        Dim masterTable As GridTableView = (TryCast(sender, Telerik.Web.UI.RadGrid)).MasterTableView
        Dim categoryEditor As GridTemplateColumnEditor = TryCast(masterTable.GetBatchColumnEditor("locncode"), GridTemplateColumnEditor)
 
        If categoryEditor IsNot Nothing Then
            Dim ddlLocationCode As RadDropDownList = TryCast(categoryEditor.ContainerControl.FindControl("locncode"), RadDropDownList)
 
            If ddlLocationCode IsNot Nothing Then
                ddlLocationCode.DataSource = SPs.fp_IV40700_SEL_YardOperations(False, App.ConnectionString).getTable 
                ddlLocationCode.DataBind()
            End If
        End If
    Catch ex As Threading.ThreadAbortException
    Catch ex As Exception
        ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
        Me.lblError.Text = ex.Message
    End Try
 
End Sub

Saving the Edited Values

During batch updates, Telerik provides all changed rows through the BatchEditCommand event. Each command exposes both the old values and the new values, including the selected location code from the dropdown. From there, you can call your data-access layer to persist the update.

Private Sub RadGrid1_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles RadGrid1.BatchEditCommand
    Try
        For Each command As GridBatchEditingCommand In e.Commands
            Dim newValues As Hashtable = command.NewValues
            Dim oldValues As Hashtable = command.OldValues
 
            Dim strPONumber As String = oldValues("ponumber")
            Dim intOrd As Int32 = oldValues("ord")
            Dim RowID As Int32 = oldValues("oldValues")
 
            ' Access the new values
            Dim strLocationCode As String = newValues("locncode")
 
            'data access code to update the location code on the line here
            '
            '
        Next
    Catch ex As ThreadAbortException
    Catch ex As Exception
        'error handling code
    End Try
End Sub

 

Summary

Using a GridTemplateColumn gives you predictable, fully controlled dropdown behavior in Batch Edit mode — something the built-in GridDropDownColumn can’t always guarantee. This pattern keeps the UI consistent and ensures your batch updates save cleanly.

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences