Solved

asp gridview header over flow off border in page

Posted on 2016-08-02
15
53 Views
Last Modified: 2016-08-08
asp.net c#
Newbie to asp c# .net


I have a grid view on a form..(not the sitemaster form).
I keep getting the headers of the grid to flow off the form.
The need the white space to fill up to the edge of the last header column.


Thanks
fordraiders
WHITE-SPACE.png
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
  • 3
15 Comments
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 41739779
surround your gridview in a div:

<div style="overflow-x:auto;width:1024px">  <!-- or 100% -->
<asp:GridView />

</div>

Open in new window

0
 
LVL 3

Author Comment

by:fordraiders
ID: 41740101
kyle:

error with overflow-x
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41740110
kyle, could it be padding ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:Prakash Samariya
ID: 41740351
You need to apply styles to <asp:GridView>
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41740439
Prakash. Apply styles to asp gridview?
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41740993
What compiler are you using?  

overflow-x is a CSS3 property:
http://www.w3schools.com/cssref/css3_pr_overflow-x.asp

note that you can write it out like that.  You'll get the warning but it should work in the browser as long as the browser supports css 3.

you could just change to overflow: auto as well.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41741033
asp.net VS 2010
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41741036
kyle,I guess my question is also, does it look like I have the <div>  in the right place. ?
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41741042
even with this code:
The overflow: auto  still is not working.
<div style="overflow:auto;width:2024px">  <!-- or 100% -->

 <asp:GridView ID="RSVPGridview" runat="server" HeaderStyle-BackColor="#3AC0F2"  OnRowDataBound="RSVPGridview_RowDataBound" 
            HeaderStyle-ForeColor="White" OnSelectedIndexChanged="RSVP_Click" 
            DataSourceID="SqlDataSourceRSVPGridview" CellSpacing="5" GridLines="None" >

            <Columns>
                <asp:CommandField ShowSelectButton="True" />

            </Columns>


<HeaderStyle BackColor="#CCCCCC" ForeColor="Black"></HeaderStyle>

</asp:GridView>

</div>

Open in new window

0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41741049
how wide is the form.  The div looks like it's in the correct place.  
You could also try specifying a css class:
.myGrid
{
       width:1024px;
}


<asp:GridView cssClass ="myGrid"

Open in new window

0
 
LVL 10

Expert Comment

by:Prakash Samariya
ID: 41741773
You need to apply styles to <asp:GridView>
I already suggested to apply styles to Grid,

<style>.divContainer{
overflow-x: scroll; 
width: 1000px; 
Height: 300px; 
position:relative;
}
.gridview{
position:inherit;overflow:auto;
}
</style>
<div class="divContainer">
   <asp:GridView id="GridView1" cssClass="gridview" runat="server"  />
</div>

Open in new window


Try changing overflow and position values to work your solution!
0
 
LVL 3

Author Comment

by:fordraiders
ID: 41742581
prakash,
Does this get placed in the .aspx  page ?

once i do , i keep getting a overflow is not a css property name.

ans "style" cannot be nested within a <div>
0
 
LVL 10

Expert Comment

by:Prakash Samariya
ID: 41742635
Which version of CSS or HTML you are working?

these are the normals css styles!

please include in first line of HTML/aspx (in case master) code
<!DOCTYPE html>

If nor resolve, please provide redered html code to check with
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41742748
VS 2010 doesn't work well with html5.  The errors that you're seeing don't mean that the page won't render correctly.  The errors in the html page for that type can safely be ignored.  The main thing is the output after the fact.
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 41748247
kyle, your original post ending up working
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Please explain purpose of GZIP 4 56
How to filter by key press ? 6 54
C# Linq Select From List 3 43
How to reference a column by name when iterating through a GridView ? 1 32
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question