Click here to Skip to main content
15,896,063 members
Articles / Web Development / HTML

ASP.NET DataGrid Extension [Client Side Sortable/Dragable....] - Part I

Rate me:
Please Sign up or sign in to vote.
4.67/5 (22 votes)
28 Feb 2008CPOL5 min read 87.4K   1.8K   71  
An extension to the ASP.NET DataGrid control with built-in client side sorting, column dragging, fixed header, check all, uncheck all, highlight selected row, and more...
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace CodeWorks
{
    class CheckBoxHeaderTemplate:ITemplate
    {
       private Color _selectColor;
       private Color _unSelectColor;  
       public CheckBoxHeaderTemplate(Color selectColor,Color unSelectColor)
       {
           this._selectColor = selectColor;
           this._unSelectColor = unSelectColor;
       }
       public  void InstantiateIn(Control container)
       {
           CheckBox chkSelect = new CheckBox();
           chkSelect.DataBinding += new EventHandler(this.OnDataBinding);
           chkSelect.Attributes.Add("onClick", "return ChangeSelection(this,'" + this._selectColor.Name  + "','" + this._unSelectColor.Name + "');");
           container.Controls.Add(chkSelect);
       }
       public void OnDataBinding(object sender, EventArgs e)
       {

       }
    }
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Systems Limited
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions