Disable the link button link within rad grid based on some condition

This Code snippet will help you to disable the link button link within rad grid based on some condition

AspX Page

  <telerik:RadGrid ID="radgrdValuesetParameter" runat="server" AutoGenerateColumns="false"

                GridLines="None" BorderWidth="0" AllowSorting="true" AllowMultiRowSelection="false"

                PageSize="20" AllowPaging="true" PagerStyle-Mode="NextPrev" PagerStyle-AlwaysVisible="true"

                OnPageIndexChanged="radgrdValuesetParameter_PageIndexChanged"

                OnItemCommand="radgrdValuesetParameter_OnItemCommand"

                onitemcreated="radgrdValuesetParameter_ItemCreated">

                <MasterTableView DataKeyNames="ID">

                    <Columns>

                        <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="#">

                            <ItemTemplate>

                                <asp:Label ID="numberLabel" runat="server" />

                                <%# Container.DataSetIndex+1 %>

                            </ItemTemplate>

                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn HeaderText="ValuesetParameterName" UniqueName="ValuesetParameterName">

                            <ItemTemplate>

                               

                                <asp:LinkButton ID="lnkEdit" runat="server" CommandName="SomeCommand" Text='<%# Eval("Name") %>'></asp:LinkButton>

                            </ItemTemplate>

                        </telerik:GridTemplateColumn>

</ MasterTableView>

</RadGrid>


CS Page
 

protected void radgrdValuesetParameter_ItemCreated(object sender, GridItemEventArgs e)

{
 
     
if (e.Item is GridDataItem)
 
      {
 
         
GridDataItem dataItem = e.Item as GridDataItem;

          LinkButton lnkbtn = (LinkButton)dataItem.FindControl("lnkEdit");
 

          if (Convert.ToBoolean(Session["IsEditable"]) == false)

           {

              lnkbtn.Enabled = false;

              radbtnAddNew.Visible = false;

          }

      }

   }