ASP.NET Webforms Gridview width expanding outside container

Home » Client Side Programming » Web Development » ASP.NET Webforms Gridview width expanding outside container
ASP.NET Web forms Logo

Do you have an ASP.NET Webforms application with the GridView expanding outside of its container? Your markup might look like this:

Because the GridView uses a table, sometimes the width of it might expand to larger than your browser window. This might be fine (you could use the scroll bar at the bottom of the browser window), but it also might also cause a problem for example if you have the default widths (width: 100%) in your CSS. You could end up with with the inner part of the GridView extending off the right of the page.

When I originally had this problem I didn’t find a good fix by Googling. The fix is quite simple. Put a CssClass=”results” on the ResultsPanel (the outer div) and define the following CSS:

This will put a scroll bar on the bottom of the GridView.

About Phil

I have been working as a software developer since 1983. This blog could have been called "From Fortran 77, C and Cobol to C# in 20 (not so) easy years", but it doesn't sound quite right somehow. Besides I'm talking about what's happened since 2003, not before!

Leave a Reply

Your email address will not be published.


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">




Top Posts & Pages

Categories

Recent Posts

Recent Comments

Archives

Blogroll

  • Mike Cohn's Blog
  • Scott Hanselman's Blog
- sdunn@fakeemail.com

Today, Certified Scrum Trainer Scott Dunn shares his insights about the pain felt when leadership do [...]

- sdunn@fakeemail.com

After making one decision, it can be helpful to make the next decision or two at the same time. [...]

- sdunn@fakeemail.com

We say agile teams are self-organizing. Does that mean they have the right to vote someone off? [...]

- sdunn@fakeemail.com

Our virtual Certified Scrum courses aren’t tedious 16-hour Zoom snoozefests. This video shows what t [...]

- Scott Hanselman

Remote work isn't normal. It's great when it's not quarantine work, to be clear. I [...]

- Scott Hanselman

I like to showcase interesting and cool open source projects that need more attention! Go give our f [...]

- Scott Hanselman

We've all learned the hard way that Quarantine work is not Remote work. It doesn't feel th [...]

- Scott Hanselman

The Internet Engineering Task Force (IETF) points out that "Master-slave is an oppressive metap [...]

- Scott Hanselman

During the Microsoft Build keynote last week - that you can watch free online here - we snuck in a L [...]

Meta