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

  • Home
  • SEARCH
  • 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 7724335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:39:44+00:00 2026-06-01T04:39:44+00:00

I realized that ShowHeaderWhenEmpty only works in PostBacks. Is there any way to make

  • 0

I realized that ShowHeaderWhenEmpty only works in PostBacks. Is there any way to make it work once the page is loaded?

<asp:GridView ID="GridView1"... ShowHeaderWhenEmpty="true"... >
<EmptyDataTemplate>
<asp:Label ID="Label1" runat="server" Text="No records found"></asp:Label>
</EmptyDataTemplate>

When I have no info to show, the above message only appears in PostBacks, no when the page is loaded.

  • 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-06-01T04:39:45+00:00Added an answer on June 1, 2026 at 4:39 am

    Note: This answer assumes (based on your question) you are binding your GridView to a data source on PostBack, and not at all during Page_Load. Please correct me if I’m wrong.

    The <EmptyDataTemplate> content only shows once your GridView has been databound. If you are only databinding on Postback (based on some user interaction) one way to solve this problem would be to bind your GridView to an empty (artificial) dataset, just so the <EmptyDataTemplate> will show.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack
            Dim table As New DataTable
            GridView1.DataSource = table
            GridView1.DataBind()
        End If
    End Sub
    

    From the MSDN article on the EmptyDataTemplate (emphasis mine):

    The empty data row is displayed in a GridView control when the data
    source that is bound to the control
    does not contain any records.

    If there is no datasource bound to the control, this property is not yet relevant.

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

Sidebar

Related Questions

I realized that you cannot just insert <iframe src=remote-page-here></iframe> and expect it to work,
Realized that VS2010 Beta2 has separate WCF RIA installation package which only works with
Context I realized that in Twitter , the profile page is displayed in different
Only today I realized that I was missing this in my PHP scripts: mysql_set_charset('utf8');
I just realized that I don't see a way to collect a string from
Ok I have realized that there is a ton of stuff about fading images
I've realized that there's no downcasting in php5. Is there a common pattern to
I just realized that if I use this code to round only the top
I just realized that when I place a form tag on my layout page,
I just realized that (according to some QML Bugreport) there is JSON Delegate for

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.