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 76277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:38:54+00:00 2026-05-10T20:38:54+00:00

On an ASP.NET page, I have a GridView populated with the results of a

  • 0

On an ASP.NET page, I have a GridView populated with the results of a LINQ query. I’m setting the DataSource in code, then calling DataBind on it. In the GridView’s RowDataBound event, I’m selectively hiding links in some GridView fields based on the query results. (For instance, I hide the ‘Show Parent’ link of the row in question has no parent row.)

This works fine initially. But on postback (when I don’t call DataBind, but the GridView stays populated through ViewState), the data displays, but the RowDataBound event (obviously) doesn’t fire, and my links don’t get hidden.

What’s the best way to get the links to be hidden after a postback?

  • 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. 2026-05-10T20:38:54+00:00Added an answer on May 10, 2026 at 8:38 pm

    Here’s how I ended up solving this:

    1. I created a serializable class with readonly properties: PK of a row, and a boolean for each link indicating whether it’s enabled or not. We’ll call it LinkVisibility.
    2. I created a serializable class inheriting from KeyedCollection to hold instances of the class above.
    3. I created a ViewState-backed property holding an instance of that collection.
    4. In my Search procedure (populating the GridView), I clear the collection.
    5. In RowDataBound, which initially shows/hides the links, I add a LinkVisibility instance to the collection for each row.
    6. In Page.Load, when IsPostBack is true, I loop through the GridView rows. I look up the LinkVisibility for each one by PK in the collection (DataKeyNames is set in the GridView), and I set the links accordingly.

    I don’t know that this is the best way to do this, but it certainly does work, which is more than I can say for anything else I’ve tried.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer These link might be useful to you: http://java.sun.com/webservices/docs/2.0/tutorial/doc/JAXWS4.html http://java.sun.com/webservices/docs/2.0/tutorial/doc/JAXBWorks4.html#wp82947 http://www.google.com/search?hl=en&q=data+type+supported+in+jax-ws&aq=f&oq=… May 11, 2026 at 10:13 am
  • added an answer SELECT ( SELECT COUNT(*) FROM tab1 ) AS count1, (… May 11, 2026 at 10:13 am
  • added an answer >>> re.match('(get|post|put|head)\s+(\S+) ','GET some-site.com HTTP/1.0 ...',re.IGNORECASE).groups() ('GET', 'some-site.com') >>> May 11, 2026 at 10:13 am

Related Questions

On an ASP.NET page, I have a GridView populated with the results of a
I have an ASP.NET page with a gridview control on it with a CommandButton
I have a button on an ASP.Net page that will call Response.Redirect back to
I have an ASP.Net page that will be hosted on a couple different servers,
I have an ASP.NET page which has a script manager on it. <form id=form1
ASP.NET 1.1 - I have a DataGrid on an ASPX page that is databound
I have an ASP.NET web page with a Login control on it. When I
I have an ASP.NET Site that has a single Master Page. On one of
I'm working on an ASP.NET page, using VB.NET and I have this hierarchy: Page
i have to create an asp.net page dynamically on runtime. It should work like

Trending Tags

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

Top Members

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.