Solved

asp gridview header over flow off border in page

Posted on 2016-08-02
15
44 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
  • 8
  • 4
  • 3
15 Comments
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
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
Comment Utility
kyle:

error with overflow-x
0
 
LVL 3

Author Comment

by:fordraiders
Comment Utility
kyle, could it be padding ?
0
 
LVL 8

Expert Comment

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

Author Comment

by:fordraiders
Comment Utility
Prakash. Apply styles to asp gridview?
0
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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
Comment Utility
asp.net VS 2010
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

by:fordraiders
Comment Utility
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
Comment Utility
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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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 8

Expert Comment

by:Prakash Samariya
Comment Utility
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
Comment Utility
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 8

Expert Comment

by:Prakash Samariya
Comment Utility
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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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
Comment Utility
kyle, your original post ending up working
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now