Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody,

I have a GridView which is nested inside a Repeater. Now I want to fix the header of this GridView. I used many article and posts and each time I got the same error in the looking and design which is: the header goes out of the GridView. It means that the GridView has a vertical and horizontal scrolls. When I try to fix the header, the header goes out of the GridView area and I don't know why.

For example, I use the following simple CSS code:
CSS
<style>
          .header
          {
            position:absolute;
          }
        </style>


and the ASP.NET code:
<div style="width:700px; height:300px; overflow:auto; overflow-y:auto;">
                <asp:GridView ID="GridView1" runat="server" 
                                AllowSorting="True" 
                                CellPadding="3" 
                                DataSourceID="SqlDataSource1" 
                                ClientIDMode="Static"
                                CssClass="mGrid"
                                AlternatingRowStyle-CssClass="alt" 
                                RowStyle-HorizontalAlign="Center" 
                                OnRowDataBound="GridView1_RowDataBound" OnPreRender="GridView1_PreRender">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <HeaderStyle Font-Bold = "true" ForeColor="Black" CssClass="header" Height="20px"/> 
                    <Columns>
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                </div>


And I don't know why I am having this problem. Any help please?
Posted

1 solution

Inside a Repeater you cant adjust The header as it changes its position dynamically with the contents of the grid view...Sorry!!!!!!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900