Hi,
I have a web page (asp.net, code:c#). I havean html table with text boxes.
Based on the user input , records are displayed in the data grid below it.
Now the datagrid has a large no. of columns. & depending on what the user
enters, the data grid can grow very large. So to avoid scrolling the whole
page, I just want the data grid to be scrollable. For this I used the <div>
tags around the data grid,
<div id="DGMainHolde r"style="OVERFL OW:scroll;WIDTH :960px;HEIGHT:9 00px">
<asp:DataGrid>a ll data grid code here</asp:dataGrid>
</div>
But when I vertically scroll the grid , the grid enters into the html table
with text boxes at the top. Also at the top is an image. I just want to make
the data grid vertically scrollable, so that it doesnt get inside the
controls above it.
My HTML code is:
<form id="Form1" method="post" runat="server">
<asp:image id="Image1" style="Z-INDEX: 102; LEFT: 389px; POSITION:
absolute; TOP: 8px" runat="server"
ImageUrl="file:///C:\Documents and Settings\pmud\M y
Documents\image s\small.jpg"></asp:image><asp: label id="Label1"
style="Z-INDEX: 103; LEFT: 400px; POSITION: absolute; TOP: 119px"
runat="server"
Font-Bold="True" Font-Underline="True " Width="96px">VI EW
LOGS</asp:label><asp: linkbutton id="LinkButton1 " style="Z-INDEX: 104; LEFT:
94px; POSITION: absolute; TOP: 99px"
runat="server" Width="9px" Height="3px">Ho me</asp:linkbutton> </td>
<TABLE id="Table1" style="Z-INDEX: 107; LEFT: 303px; WIDTH: 305px;
POSITION: absolute; TOP: 148px; HEIGHT: 91px"
cellSpacing="1" cellPadding="1" width="305" border="1">
<TR>
<TD style="WIDTH: 126px; HEIGHT: 25px">
<asp:label id="lblCompany " runat="server" Font-Bold="True"
Width="117px" Height="5px">Co mpany Name</asp:label></TD>
<TD style="HEIGHT: 25px">
<asp:textbox id="txtCompany " runat="server" Width="139px"
Height="24px"></asp:textbox></TD>
</TR>
<TR>
<TD style="WIDTH: 126px; HEIGHT: 27px">
<asp:label id="lblMonth" runat="server" Font-Bold="True"
Width="91px" Height="5px">Mo nth</asp:label></TD>
<TD style="HEIGHT: 27px">
<asp:dropdownli st id="ddlMonth" runat="server" Width="115px"
Height="8px">
<asp:ListItem Value="None">No ne</asp:ListItem>
<asp:ListItem Value="January" >January</asp:ListItem>
<asp:ListItem Value="Feburary ">Feburary</asp:ListItem>
<asp:ListItem Value="March">M arch</asp:ListItem>
<asp:ListItem Value="April">A pril</asp:ListItem>
<asp:ListItem Value="May">May </asp:ListItem>
<asp:ListItem Value="June">Ju ne</asp:ListItem>
<asp:ListItem Value="July">Ju ly</asp:ListItem>
<asp:ListItem Value="August"> August</asp:ListItem>
<asp:ListItem Value="Septembe r">September </asp:ListItem>
<asp:ListItem Value="October" >October</asp:ListItem>
<asp:ListItem Value="November ">November</asp:ListItem>
<asp:ListItem Value="December ">December</asp:ListItem>
</asp:dropdownlis t></TD>
</TR>
<TR>
<TD style="WIDTH: 126px">
<asp:label id="Label2" runat="server" Font-Bold="True" Width="5px"
Height="5px">Ye ar</asp:label></TD>
<TD>
<asp:textbox id="txtYear" runat="server" Width="126px"
Height="25px"></asp:textbox></TD>
</TR>
</TABLE>
<asp:button id="btnSubmit" style="Z-INDEX: 101; LEFT: 397px; POSITION:
absolute; TOP: 261px"
runat="server" Text="Submit"></asp:button></td>
<div id="DGMainHolde r"
style="OVERFLOW :scroll;WIDTH:9 60px;HEIGHT:900 px"><asp:datagr id id=DataGrid1
style="Z-INDEX: 105; LEFT: 0px; POSITION: absolute; TOP: 478px"
runat="server" ForeColor="Blac k" CellPadding="4" BackColor="#CCC CCC"
CellSpacing="2" BorderWidth="3p x" BorderStyle="So lid" BorderColor="#9 99999"
AutoGenerateCol umns="False" DataKeyField="A siOrder#" DataMember="For mFields"
DataSource="<%# dsCompany1 %>">
<FooterStyle BackColor="#CCC CCC"></FooterStyle>
<SelectedItemSt yle Font-Bold="True" ForeColor="Whit e"
BackColor="#000 099"></SelectedItemSty le>
<ItemStyle BackColor="Whit e"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="Whit e"
BackColor="Blac k"></HeaderStyle>
<Columns>
<asp:EditComman dColumn ButtonType="Lin kButton" UpdateText="Upd ate"
CancelText="Can cel" EditText="Edit" ></asp:EditCommand Column>
<asp:BoundColum n DataField="Date " SortExpression= "ActivationDate "
ReadOnly="True" HeaderText="Dat e"
DataFormatStrin g="{0:d}">
<ItemStyle Width="70px"></ItemStyle>
</asp:BoundColumn >
<asp:BoundColum n DataField="Regi on" SortExpression= "Region"
ReadOnly="True" HeaderText="Reg ion">
<ItemStyle Width="55px"></ItemStyle>
</asp:BoundColumn >
<
<asp:BoundColum n DataField="Comp anyRepID"
SortExpression= "CompanyRep ID" ReadOnly="True" HeaderText="Com pany RepID">
<ItemStyle Width="35px"></ItemStyle>
</asp:BoundColumn >
<asp:BoundColum n DataField="Acco unt#" SortExpression= "Account#"
ReadOnly="True" HeaderText="Acc ount">
<ItemStyle Width="50px"></ItemStyle>
</asp:BoundColumn >
<asp:BoundColum n DataField="User Name" SortExpression= "UserName"
ReadOnly="True" HeaderText="Use r">
<ItemStyle Width="60px"></ItemStyle>
</asp:BoundColumn >
</Columns>
<PagerStyle HorizontalAlign ="Left" ForeColor="Blac k"
BackColor="#CCC CCC" Mode="NumericPa ges"></PagerStyle>
</asp:datagrid></div>
</body>
</form>
--
pmud