Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Scrolling of a datagrid

Reply
Thread Tools

Scrolling of a datagrid

 
 
Sumit
Guest
Posts: n/a
 
      11-15-2003
Hi,
I want to make a datagrid to be scrollable instead of
paging in it. So i have out that datagrid html tags inside
<div></div> tags and made that div scrollable.
Due to this if i scroll down the datagrid,,header also
gets off the view because that header is also considered
as a row in datagrid!!
I want datagrid to be scrollable but header of the
datagrid should always be there.
Please suggest,
Thanks
 
Reply With Quote
 
 
 
 
Oliver
Guest
Posts: n/a
 
      11-15-2003
Creating a Scrollable DataGrid with a Fixed Header
By: Scott Mitchell

http://datawebcontrols.com/faqs/Cust...edHeader.shtml

"Sumit" <> wrote in message
news:00f701c3ab50$2280ddf0$...
> Hi,
> I want to make a datagrid to be scrollable instead of
> paging in it. So i have out that datagrid html tags inside
> <div></div> tags and made that div scrollable.
> Due to this if i scroll down the datagrid,,header also
> gets off the view because that header is also considered
> as a row in datagrid!!
> I want datagrid to be scrollable but header of the
> datagrid should always be there.
> Please suggest,
> Thanks



 
Reply With Quote
 
 
 
 
sumit
Guest
Posts: n/a
 
      11-16-2003
Hi,

That articles talks about creating an html table,,
but i need to have sorting facility as well in that header
rows and also data grid will have hori. scroll bar in
it,,so moving data grid scroll bar horizontally,,upper
html table should also also get scrolled,,,and no
horizontal bar should be shown in the header html table!!

Please suugest me or send me the code if anyone can as it
is required very urgent!!

Thanks
>-----Original Message-----
>Creating a Scrollable DataGrid with a Fixed Header
>By: Scott Mitchell
>
>http://datawebcontrols.com/faqs/Cust...ppearance/Scro

llableDataGridWithFixedHeader.shtml
>
>"Sumit" <> wrote in message
>news:00f701c3ab50$2280ddf0$...
>> Hi,
>> I want to make a datagrid to be scrollable instead of
>> paging in it. So i have out that datagrid html tags

inside
>> <div></div> tags and made that div scrollable.
>> Due to this if i scroll down the datagrid,,header also
>> gets off the view because that header is also considered
>> as a row in datagrid!!
>> I want datagrid to be scrollable but header of the
>> datagrid should always be there.
>> Please suggest,
>> Thanks

>
>
>.
>`

 
Reply With Quote
 
Jeremy Chapman
Guest
Posts: n/a
 
      11-19-2003
there's a few solutions, here's one that I devised. As far as I know, no
matter what, you'll essentially need two tables or grids. one for the
header and one for the body. You basically need to hide the header row from
your datagrid, and create a new table/grid with the header information.
Here is my solution which consists of two files. An external .css file and
the .aspx page

In an external .css file (I used GlobalStyles.css):

..divHeader
{
height: 30;
width: 100%;
overflow: hidden;
}

..tblHeader
{
height: 30;
width: 100%;
overflow: hidden;
}

..divBody
{
width: 100%;
height: 590;
overflow: auto;
}

..tblBody
{
width:100%;
}

End of external .css file.

In the <HEAD> section of the .aspx page:
<script>
function GetJSObject(objID)
{
var myObj;

if(document.getElementById)
{
myObj = document.getElementById(objID);
}
else if (document.layers)
{
myObj = document.layers[objID];
}
else if (document.all)
{
myObj = document.all(objID);
}

return(myObj);
}

function Scroll()
{
GetJSObject("divHeader").scrollLeft =
GetJSObject("divBody").scrollLeft;
}
</script>
<LINK href="GlobalStyles.css" type="text/css" rel="stylesheet">

End of <HEAD> section.

In the <BODY> section of the .aspx file:

<div class="divHeader" id="divHeader">
<asp:table id="tblHeader" runat="server"
EnableViewState="False" CssClass="tblHeader"></asp:table>
</div>
<div class="divBody" id="divBody" onscroll="Scroll();">
<asp:table id="tblBody" runat="server" EnableViewState="False"
CssClass="tblBody"></asp:table>
</div>

End of <BODY> section.


That's it. I used Tables, but you could use a grid as well. Populate tblBody
however you like, then populate tblHeader with one row. That row should have
the same number of cells stretching horizontally that a single row in
tblBody has. This solution does require a little bit of javascript, but I
couldn't find a solution simply using divs or any other html tag.

"Sumit" <> wrote in message
news:00f701c3ab50$2280ddf0$...
> Hi,
> I want to make a datagrid to be scrollable instead of
> paging in it. So i have out that datagrid html tags inside
> <div></div> tags and made that div scrollable.
> Due to this if i scroll down the datagrid,,header also
> gets off the view because that header is also considered
> as a row in datagrid!!
> I want datagrid to be scrollable but header of the
> datagrid should always be there.
> Please suggest,
> Thanks



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
smooth scrolling & auto scrolling sillyputty Firefox 1 08-24-2007 02:10 AM
Enable Datagrid vertical scrolling instead of paging in .NET Ashvin Navare ASP .Net 0 11-16-2003 06:59 AM
Datagrid scrolling by putting it in another window? Bruce W...1 ASP .Net 2 11-06-2003 03:30 PM
Scrolling in datagrid. Saravana [MVP] ASP .Net 6 10-16-2003 09:52 PM
Datagrid header and scrolling, abacnet ASP .Net 1 08-11-2003 03:52 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57