Link button Radgrid

This code snippet demonstrats how navigate the one page from another page by clicking with help of link buton inside the rad grid

<telerik:GridTemplateColumn HeaderText="Date" UniqueName="Date">
< ItemTemplate><asp:LinkButton ID="lnkEdit" runat="server" CommandName="SomeCommand" Text='<%# Eval("HolidayDate") %>'></asp:LinkButton>

< /ItemTemplate>

< /telerik:GridTemplateColumn>

In CS page

protected void radgrdHoliday_ItemCommand(object sender, GridCommandEventArgs e)

{

GridDataItem dataItem = (GridDataItem)((LinkButton)e.CommandSource).NamingContainer;

string id = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["ID"].ToString();

ViewState[

"TypeID"] = dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["TypeId"].ToString();

Response.Redirect(

"HolidayDetails.aspx?ID=" + id);

}

 

Ebook Download
View all
Learn
View all