开发者

Telerik RaGrid - How to add Edit column at design time

开发者 https://www.devze.com 2023-03-23 10:48 出处:网络
This is a column in my Telerik Rad Grid <telerik:GridTemplateColumn HeaderText=\"Action\" UniqueName=\"d开发者_如何学CtgColActions\"Groupable=\"false\" Reorderable=\"false\">

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
            {

            }
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消