Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. GridView with ShowFooter and 0 rows

GridView with ShowFooter and 0 rows

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dr_X
    wrote on last edited by
    #1

    Is there a quick and easy way to show the Footer & Header of a GridView when datasource come back with 0 rows? Michael

    I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

    K 1 Reply Last reply
    0
    • D Dr_X

      Is there a quick and easy way to show the Footer & Header of a GridView when datasource come back with 0 rows? Michael

      I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      Here is some code: create this event if you don't already have it.

      protected void GridView1_PreRender(object sender, EventArgs e)
      {
      if ((GridView1.PagerSettings.Position == PagerPosition.Top ||
      GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
      GridView1.TopPagerRow != null)
      {
      if (!GridView1.TopPagerRow.Visible)
      {
      GridView1.TopPagerRow.Visible = true;
      }
      }
      if ((GridView1.PagerSettings.Position == PagerPosition.Bottom ||
      GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
      GridView1.BottomPagerRow != null)
      {
      if (!GridView1.BottomPagerRow.Visible)
      {
      GridView1.BottomPagerRow.Visible = true;
      }
      }
      }

      Hope that helps. Ben

      D 1 Reply Last reply
      0
      • K kubben

        Here is some code: create this event if you don't already have it.

        protected void GridView1_PreRender(object sender, EventArgs e)
        {
        if ((GridView1.PagerSettings.Position == PagerPosition.Top ||
        GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
        GridView1.TopPagerRow != null)
        {
        if (!GridView1.TopPagerRow.Visible)
        {
        GridView1.TopPagerRow.Visible = true;
        }
        }
        if ((GridView1.PagerSettings.Position == PagerPosition.Bottom ||
        GridView1.PagerSettings.Position == PagerPosition.TopAndBottom) &&
        GridView1.BottomPagerRow != null)
        {
        if (!GridView1.BottomPagerRow.Visible)
        {
        GridView1.BottomPagerRow.Visible = true;
        }
        }
        }

        Hope that helps. Ben

        D Offline
        D Offline
        Dr_X
        wrote on last edited by
        #3

        Unfortunately it didn't help with the showing of the Footer or Header when the grid's datasource property has 0 rows. Basically the insert/add new section of the grid is in the grid's Footer. When there are not rows to display for editing, I would still like the footer to display so that users can insert a new row. Michael

        I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups