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 height to 100%

GridView height to 100%

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netsysadminhelp
1 Posts 1 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.
  • S Offline
    S Offline
    Stevo Z
    wrote on last edited by
    #1

    Hi guys, I have following problem: I want to display two GridViews A, B one next to the other. So I've created a simple table with one row and two columns a put griview A into the left column and the GridView B into to right column:

    <table>
    <tr>
    <td>
    A
    </td>
    <td>
    B
    </td>
    </tr>
    </table>

    I know that after items are loaded, the A will always be higher than B, so I would like to stretch B so it takes same amount of height as A. I've set the Height property on B to 100%:

    <asp:GridView ID="B" runat="server" AutoGenerateColumns="False" Height="100%">
    ...
    </asp:GridView>

    But the B keeps the minimum height it requires to render all rows and won't stretch to same size as A. Note that A and B are in cells of the same row, so B has available height to strech to. After some investigation I've discovered that by default, a GridView is a <table> encapsulated within a <div>. And its the div that prevents the table to stretch above its minimum required height. Is there a way how to tell ASP.NET to NOT render the (empty) <div> html tag around the table? Or change the behaviour of the <div> to not prevent table to be stretched to any available size?

    zilo

    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