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. JavaScript
  4. Find Gridview Footer Row

Find Gridview Footer Row

Scheduled Pinned Locked Moved JavaScript
javascripttutorial
2 Posts 2 Posters 5 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.
  • S Offline
    S Offline
    SatyaKeerthi15
    wrote on last edited by
    #1

    I have to Find Gridview Footer Row in Javascript. Is there any chance to show/hide footer row in javascript. How to Find Label in Footer Row.

    Steve EcholsS 1 Reply Last reply
    0
    • S SatyaKeerthi15

      I have to Find Gridview Footer Row in Javascript. Is there any chance to show/hide footer row in javascript. How to Find Label in Footer Row.

      Steve EcholsS Offline
      Steve EcholsS Offline
      Steve Echols
      wrote on last edited by
      #2

      Here's one way to do it: 1) You need to give your gridview footer row an ID. You can do this in RowCreated (sorry it's VB, that's the project I had open at the moment :)):

      Protected Sub gvT\_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvT.RowCreated
      
      	If e.Row.RowType = DataControlRowType.Footer Then
      		e.Row.ID = "theFooter"
      	End If
      
      End Sub
      

      This will give you a footer row like <tr id='ctl00_gvT_theFooter'> Now to get at it using javascript do something like:

      function toggleFooter()
      {
      	var ftr = document.getElementById('<%=gvT.ClientID %>\_theFooter');
      	if (ftr.style.display != 'none')
      		ftr.style.display = 'none';
      	else	
      		ftr.style.display = '';
      }
      
      1. If you're using templatefields in your grid view something like:

      <asp:gridview id="gvT" runat="server" showfooter="true" autogeneratecolumns="false">
      <columns>
      asp:templatefield
      <itemtemplate>
      <%#Eval("MyField") %>
      </itemtemplate>
      <footertemplate>
      <asp:label id="lblFooterLabel1" runat="server"></asp:label>
      </footertemplate>
      </asp:templatefield>
      </columns>
      </asp:gridview>

      You can access it using:

      function getFooterLabel()
      {
      	var lbl = document.getElementById('&<%=gvT.ClientID %>\_theFooter\_lblFooterLabel1');
                  return lbl;
      }
      

      - S 50 cups of coffee and you know it's on! Code, follow, or get out of the way.

      • S
        50 cups of coffee and you know it's on!
        Code, follow, or get out of the way.
      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