Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 613797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:02:33+00:00 2026-05-13T18:02:33+00:00

I have a GridView : <asp:GridView ID=GridView1 runat=server AllowPaging=True GridLines=None HorizontalAlign=Left AutoGenerateColumns=False DataSourceID=SqlDataSource1 onrowcommand=GridView1_RowCommand1>

  • 0

I have a GridView :

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" GridLines="None" 
                HorizontalAlign="Left" AutoGenerateColumns="False" 
                DataSourceID="SqlDataSource1" onrowcommand="GridView1_RowCommand1">            
                <HeaderStyle HorizontalAlign="Left" />                            
                <Columns>  
                   <asp:TemplateField HeaderStyle-Width="150">
                        <HeaderTemplate>
                            <b>Downloads</b>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <!-- <asp:HyperLink ID="hyperlinkDownload" runat="server" NavigateUrl="" >Download 
                            MP3</asp:HyperLink> -->
                            <asp:LinkButton CommandName="download"
                             CommandArgument='<%# Eval("Name") %>' runat="server">Download MP3</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>    

</asp:GridView>

I want to query the value of a particular field in a DB and if it’s true, display the LinkButton. if false, I want the linkButton not to be displayed.

is there a way to access the GridView programmatically and make visible certain of its columns or manipulate its items ?

help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:02:34+00:00Added an answer on May 13, 2026 at 6:02 pm

    You can do this by adding a handler to the RowDataBound event. Add an event handler along this lines of this in your code behind:

    protected void myGrid_RowDataBound(Object sender, GridViewRowEventArgs e)
    {
        var data = e.Row.DataItem as DataRowView;
        if (data != null)
        {
            var lbtDownload = e.Row.FindControl("lbtDownload");
            lbtDownload.Visible = (bool) data.Row["HasFileForDownload"];
        }
    }
    

    In your markup, attach the event handler to the grid:

    <asp:GridView OnRowDataBound="myGrid_RowDataBound" ...>
    

    You will also need to assign an id to the LinkButton, matching the one that you are search for using the FindControl() method in the event handler.

    Disclaimer: I am on currently a Linux machine with no chance of testing this. Please report any bugs in the code – feel free to correct them if you have editor rights.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer My snow leopard only has python 2.5 and 2.6 installed,… May 16, 2026 at 6:39 pm
  • Editorial Team
    Editorial Team added an answer This isn't hard to do -- I wouldn't start messing… May 16, 2026 at 6:39 pm
  • Editorial Team
    Editorial Team added an answer The file format would permit up to 255-character worksheet names,… May 16, 2026 at 6:39 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a GridView in my page : <asp:GridView ID=GridView1 runat=server AllowPaging=True BackColor=White AutoGenerateColumns=False
hi I have this gridview like this. <asp:DropDownList ID=triggerDropDown runat=server AutoPostBack=true onselectedindexchanged=triggerDropDown_SelectedIndexChanged> <asp:GridView ID=myGridView
I have the following gridview that is inside an updatepanel: <asp:UpdatePanel ID=UpdatePanel1 runat=server> <ContentTemplate>
I have an ASP.NET GridView control in a Web Form. For the sake of
Just starting with ASP.NET and find it difficult to use the GridView. I have
I have a gridview that displays all trips - within that gridview I have
i have to fill a gridview with a dbcoommand. The code that i have
I have a gridview that I want to validate when it is in edit
I have a GridView which retrieves data from a database. Users have roles, some
I have gridview that I am using paging on. I want to pass along

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.