Click here to Skip to main content
15,892,746 members
Articles / Web Development / ASP.NET

ASP.NET DataGrid Header Slider Control

Rate me:
Please Sign up or sign in to vote.
3.44/5 (24 votes)
21 Mar 20041 min read 136.1K   2.6K   41  
ASP.NET DataGrid Header plug-in that allows the header to stay on screen.
<script language="javascript">
// ---------------------------------------------------------
// Tony Truong's GridSlideHeader
// Copyright (C) 2003 Tony Truong. All rights reserved.
// http://www.TonyTruong.com/Projects/GridSlideHeaderDemo/GridSlideHeaderDemo.aspx
// http://www.TonyTruong.com/Projects/GridSlideHeaderDemo/GridSlideHeaderDemo2.aspx
// For further reference see http://codeproject.com/aspnet/GridSlideHeader.asp
// ---------------------------------------------------------
// This is customized javascript that is used to create the id's and docking content
// This script was created for ASP.NET but should be usable with any table like object
// such as DataList, DataGrid, and repeaters

	var dg = document.getElementById("_DATAGRIDID");

	//find first element of the grid	
	var oParent = dg.firstChild.firstChild;
	var oElement = oParent.firstChild;
	
	var nCount = 0;
	
	//make sure it's a TD value in this child
	while(oElement != null && oElement.tagName == "TD")
	{
		//if we already have an ID, then lets use it .. otherwise, create the id as dockcontentX
		//this will allow using the GridSlideheader with other user controls that utilize the id property
		if(oElement.id.length == 0)
		{
			oElement.id = "dockcontent" + nCount.toString();
		}
		oElement.style.position = "relative";
		var dockX = new dockit(oElement.id, 0);
		
		oElement = oElement.nextSibling;
		nCount++;
	}
</script>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect Frontline Direct Inc., Adconion
United States United States
Tony Truong graduated from UCLA in Spring of 2001 and starting worked at Symantec Corporation as a Software Engineer. After a few years of developing various features for Norton SystemWorks, Tony moved to San Diego. He is currently writing database applications using ASP.NET and C# with the .NET Framework. Tony specializes in tara-byte databases with emphasis on high availability, optimization, and complex entity modeling.

Comments and Discussions