How to hide hyperlink in Gridview column RRS feed

  • Question

  • User-900007357 posted

    I want to hide the hyperlink for the FOLDER value from the following code. Please share your thoughts. 


    <asp:gridview ID="grv" runat="server" AutoGenerateColumns="False">
    <asp:BoundField DataField="ORG_NAME" HeaderText="Organization Name" />
    <asp:HyperLinkField DataNavigateUrlFields="FOLDER" DataTextField="FOLDER" HeaderText="Folder" />


    Wednesday, October 31, 2018 2:53 PM

All replies

  • User61956409 posted

    Hi Dakshina,

    hide the hyperlink for the FOLDER value from the following code

    Hide HyperLinkField in code behind:

    protected void grv_RowDataBound(object sender, GridViewRowEventArgs e)
        if (e.Row.RowType == DataControlRowType.DataRow)
            e.Row.Cells[1].Style.Add("visibility", "hidden");

    Hide HyperLinkField in client side:

        td:nth-child(2) a {
            visibility: hidden;

    Or you can specify the Visible property of HyperLinkField to false:

     <asp:HyperLinkField DataNavigateUrlFields="FOLDER" DataTextField="FOLDER" HeaderText="Folder" Visible="false"/>

    With Regards,

    Fei Han

    Thursday, November 1, 2018 1:49 AM
  • User-1716253493 posted
    <asp:HyperLinkField DataNavigateUrlFields="FOLDER" Text="Open" HeaderText="Folder" />
    <asp:HyperLinkField DataNavigateUrlFields="FOLDER" DataTextField="AnotherField" HeaderText="Link" />

    Thursday, November 1, 2018 2:28 AM