Telerik ASP.NET Radgrid - Link Column

Here's a couple of techniques to get a link button in a grid

Related Articles

... and you 'll find more on the Telerik ASPNET Grid Menu

<telerik:GridTemplateColumn HeaderText="Vendor" >
    <ItemTemplate>
        <asp:LinkButton ID="lnkVendor" runat="server" CommandName="Edit" Text='<%# Eval("vendname")  %>'></asp:LinkButton>
    </ItemTemplate>
</telerik:GridTemplateColumn>

 

Respond to the click like this:

Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGrid1.ItemCommand
    If TypeOf e.Item Is GridDataItem Then
        If e.CommandName = "Edit" Then
            'requires that the referenced field be in the DataKeyValues in the grid
            Session("BudgetID") = RadGrid1.MasterTableView.DataKeyValues(e.Item.ItemIndex)("BudgetID")
            Response.Redirect("MasonRatesVendorM.aspx")
        End If
    End If
End Sub

Or, this:

<telerik:GridButtonColumn ItemStyle-Width="50" Text="Edit" UniqueName="btnEdit" CommandName="Edit" ></telerik:GridButtonColumn>
Private Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
    Select Case e.CommandName
        Case "Edit"
            Dim strColumnName As String = RadGrid1.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Column_Name").ToString
            Dim strTableName As String = RadGrid1.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Table_Name").ToString
 
            Response.Redirect(String.Format("~/dynColumnEdit.aspx?TableName={0}&ColumnName={1}", strTableName, strColumnName))
    End Select
End Sub

 



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