Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i hv designed a gridview with div tag which is scrollabe , but when i scroll the grid its header part is also scrolled. header part should not be scrolled for my requirement.
Plz Provide me idea...
Below is my code......
XML
<div id="divCall" class="div">

<asp:GridView ID="GridCall" runat="server" CssClass="Grid"
        AutoGenerateColumns="false" RowStyle-HorizontalAlign="Justify"
        ShowHeader="true" ShowFooter="false" AllowPaging="false"
        GridLines="Horizontal"
        onselectedindexchanged="GridCall_SelectedIndexChanged" AutoGenerateSelectButton="true">

<HeaderStyle BackColor="AliceBlue" BorderStyle="Double" Height="25px" HorizontalAlign="Center" VerticalAlign="Middle" />
<RowStyle BackColor="Wheat" BorderStyle="Solid" Height="20px" VerticalAlign="Middle" HorizontalAlign="Center"/>
<Columns>
<asp:TemplateField ShowHeader="true" HeaderText="Call ID" >
<ItemTemplate> <asp:TextBox ID="txtCallID" runat="server" CausesValidation="false" ReadOnly="true" CssClass="txt" Text='<%# Bind("complain_no") %>'>&#39;
    &gt;</asp:TextBox></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="true" HeaderText="P No" >
<ItemTemplate> <asp:TextBox ID="txtPNo" runat="server" CausesValidation="false" ReadOnly="true" CssClass="txt" Text='<%# Bind("pno") %>'></asp:TextBox></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="true" HeaderText="Suspected Problems" >
<ItemTemplate> <asp:TextBox ID="txtProblem" runat="server" CausesValidation="false"  CssClass="txt" Text='<%# Bind("problem") %>'></asp:TextBox></ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>



and CSS code is here....
CSS
.div
{
    overflow:scroll;
    width:100%;
    height:300px;
}
.Grid
{
    width:98%;
    height:500px;
}
Posted

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