disable link in gridhyperlinkcolumn

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    36 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2010 Link to this post

    We have a hierarchical grid with a gridhyperlinkcolumn at each level. There is a parameter that comes back with the NeedDataSource query called "active". If active is true we want the link to remain active. If it is false, we want the text label to remain but the link to be inactive.

    Is there a way to do this?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Jan 2010 Link to this post


    Set the DataKeyNames as "active" and you can access corresponding value in ItemDataBound event. Then access the hyperlink in the row to disable according to your need.

        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
            if (e.Item is GridDataItem) 
                GridDataItem item = (GridDataItem)e.Item; 
                if (item.GetDataKeyValue("active").ToString() == "true"
                    HyperLink hLink = (HyperLink)item["HyperLinkColumn1"].Controls[0]; // Access the hyperlink in the row 
                    hLink.Enabled = false;  // Disable hyperlink 

  3. DevCraft R3 2016 release webinar banner
Back to Top