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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:21:37+00:00 2026-05-28T00:21:37+00:00

I have a gridview in which a specific column Date . I have set

  • 0

I have a gridview in which a specific column Date. I have set the Visible property of column to false because I want to show on different conditions of page. Please tell me how can I do it using vb.net that my Date column should show or hide at runtime

Update

My current code is

   If Not Page.User.Identity.Name = "bilal" Then
            GridView1.AutoGenerateEditButton = False

            GridView2.AutoGenerateEditButton = False
            GridView3.AutoGenerateEditButton = False
        Else
            GridView1.AutoGenerateEditButton = True
            GridView1.AutoGenerateColumns = True

            GridView1.DataBind()
            If GridView1.Columns.Count > 0 Then
                'assuming your date-column is the first '
                GridView1.Columns(3).Visible = True
            Else
                GridView1.HeaderRow.Cells(0).Visible = False
                For Each gvr As GridViewRow In GridView1.Rows
                    gvr.Cells(0).Visible = True
                Next
            End If



            GridView2.AutoGenerateEditButton = True
            GridView3.AutoGenerateEditButton = True

        End If
  • 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-28T00:21:38+00:00Added an answer on May 28, 2026 at 12:21 am

    If you’ve set AutoGenerateColumns to True, the Column-Count will be 0, then you need to loop the rows and show/hide the appropriate cells. Otherwise you can use the Visible property.

    GridView1.DataBind()
    If GridView1.Columns.Count > 0 Then
        'assuming your date-column is the 4.'
        GridView1.Columns(3).Visible = True
    Else
        GridView1.HeaderRow.Cells(3).Visible = False
        For Each gvr As GridViewRow In GridView1.Rows
            gvr.Cells(3).Visible = True
        Next
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a gridview control which will show X amount of rows. I want to
I have a gridview which is databound, I want to dynamically add a row
I have a gridview which I am binding through code behind, I want to
I have a gridview in which the first column in a checkbox. The grid
I have a GridView on my page. I want to set a cell click
I have a sql statement which I would want to ORDER BY a specific
I have a GridView which uses BoundField for columns. I am trying to set
I have GridView which I can select a row. I then have a button
I have a GridView which I am populating by calling a method to return
I have a GridView which is databound to an XML Datasource. For one of

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.