Telerik RaGrid - How to add Edit column at design time
This is a column in my Telerik Rad Grid
<telerik:GridTemplateColumn HeaderText="Action" UniqueName="d开发者_如何学CtgColActions" Groupable="false" Reorderable="false">
<ItemTemplate>
<asp:LinkButton ID="lnkActionEdit" runat="server" OnClicks="lnkEdit_Click">Edit</asp:LinkButton>
<asp:LinkButton ID="lnkActionArchive" runat="server" OnClicks="lnkArchive_Click">Archive</asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
How can I link each Edit / Archive Link to the id of that specific row?
Here's the Solution
protected void lnkEdit_Click(object sender, EventArgs e)
{
try
{
LinkButton lb = new LinkButton();
lb = (LinkButton)sender;
Control control = lb.NamingContainer;
GridDataItem gridDataItem = (GridDataItem)control;
int itemId= Convert.ToInt32(gridDataItem["dtgColItemId"].Text);
Response.Redirect("/yourpage.aspx?id=" + itemId);
}
catch
{
}
}
精彩评论