 |
|
 |
Thanks fenglinzh for the code.
Folks,I just modified the footer code a bit, so that footer will be shown at bottom of the grid when the content is less than the div height.
Hope it will be useful.
if (p_oElem.scrollHeight > p_oElem.clientHeight) {
return p_oElem.scrollHeight -
p_oElem.scrollTop - p_oElem.clientHeight;
}
else {
return 0;
}
|
|
|
|
 |
|
|
 |
|
 |
It is easy to understand. It is very helpful
|
|
|
|
 |
|
 |
One workaround is to have a separate table control to show the header elements and hide the actual header of the grid.Now put the grid inside a div or panel with scrollbar property.But that takes extra effort to have a proper alignment.Each cell of the header table should be aligned with each cell of the grid.The other work around is to fix the header of the grid in such a way that scrolling down shouldnt hide the header of the grid.Using stylesheet we can achieve that.
Add the following style in your code and assign the grid view or datagrid header style css.
.fixedHeader
{
font-weight:bold;
position:absolute;
background-color: #006699;
color: #ffffff;
height: 25px;
top: expression(Sys.UI.DomElement.getBounds(document.getElementById("panelContainer")).y-25);
}
Hope it added some value.
http://www.mindfiresolutions.com/[^]Cheers,
Eliza
|
|
|
|
 |
|
 |
Header and footer should be fix,
it is also scrolling with grid.
|
|
|
|
 |
|
 |
The CSS class needs to be elaborated on what basis parentNode has been used.
|
|
|
|
 |
|
 |
Hai,
I tried this code in my project but its not working in Firefox, IE7.
Its working only in IE6.
Please give some solutions to work in Mozilla..
Thanks
Manimaran
|
|
|
|
 |
|
 |
I used your expression for the css and the javascript to lock my GridView footer inside a div. Works perfectly. I am using i.e. 6 without allowing paging.
|
|
|
|
 |
|
 |
Hi....The dynamic top setting in the CSS is IE 5+ specific and has a bug when resizing the window. I use a DHTML/Javascirpt solution to reset the header style on page load. I'm currently supporting a fixed header on a scrolling gridview with about 1000 rows (based on search returns). This is working well in IE 6+ for me; a variation should work cross-browser.
function setHeaderPos()
{
var oHeadElement = document.getElementById("A tag in the header here")
var oHeadAnchor = document.getElementById("Div for scrolling here");
if (oHeadElement && oHeadAnchor)
{
var myPosY = findPosY(oHeadAnchor)
if(oHeadElement.offsetParent)
{
var oTH = oHeadElement.offsetParent;
//if current offset is different than calculated, reset header pos.
if ( oTH.parentElement.style.top != myPosY - 25)
{
oTH.parentElement.style.top = myPosY - 25;
oTH.parentElement.style.position ='absolute';
}
}
}
}
function findPosY(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curtop += obj.offsetTop
}
}
return curtop;
}
|
|
|
|
 |
|
 |
Thank you for the identification of bug for the left position. But the point is when to call this function???? Please do let me know as I also this solution...Thanks
|
|
|
|
 |
|
 |
My apologies for not including this...I use an inline Javascript block at the bottom of my page, Just before the </body> tag.
<script type="text/javascript">
<!--
setTimeout("setHeaderPos();",50);
//-->
</script>
</body>
I use the setTimeout function to ensure that the table is fully-rendered, otherwise the function will not run properly.
|
|
|
|
 |
|
 |
Hi, this is really nice but doesn't work in Mozilla.... Is there any other solution to make it cross browser compatible?
Thanx & Regards
R. Prakash
Kappsoft Pvt Ltd.
|
|
|
|
 |
|
 |
Hi,
You've only uploaded the front page in the zip. Needs the .aspx.vb file too.
Hope this helps,
Chitty.
http://www.leapoflogic.co.uk
|
|
|
|
 |
|
 |
Sorry for the misstake. I have updated the file.
|
|
|
|
 |
|
 |
Hi fenglinzh! Its working only on IE, not on other browser. There are lots of articles for fixing Header/Fotter of GridView. All are for IE only.
Thanks & Regards,
SAMir Nigam,
Software Engineer,
STPL, Lucknow, India.
|
|
|
|
 |
|
 |
All,
This method is good when you have a low number of rows to display in your GridView. If you get above 200 rows, there is considerable lag time when scrolling thru the row results.
|
|
|
|
 |
|
 |
Oh, is it? I will test and find out the solutions.
Thanks for the support~~
|
|
|
|
 |
|
 |
Yea. I was not trying to be negative, but merely explain that the solution does not work well when you are loading say 1,000 rows of data into your grid (in a situation where paging is NOT an option).
Your solution is excellent if paging is an option and you want to keep the pagesize at a minimal amount. Sorry if it came off otherwise.
-- modified at 13:42 Wednesday 31st October, 2007
|
|
|
|
 |