Click here to Skip to main content
Click here to Skip to main content

Enhanced DataGrid control

, 24 Jun 2003
Rate this:
Please Sign up or sign in to vote.
Extends DataGrid Functionalities

Sample Image - GridEx.jpg


This is an enhanced DataGrid that built in with Auto Search, Auto Column Sizing and Row Select features. In addition, it supports multiple Tablestyles binding to single DataTable. New events such as CurrentRowChanged and OnHeaderClick also have been included.


This component was created out of frustration with default datagrid controls. After searching around from web but could not find a Free datagrid control with the features that suit my needs. I decided to create one by myself. This is my first .NET component, feel free to give me feedbacks or comments so that I can learn something and improve my .NET skill. I hope this component is useful to those of you who are as frustrated as me.


Property Description
AutoSearch Enable or disable auto search function in datagrid.
AutoSize Enable or disable column auto sizing in datagrid.
RowSelect Enable or disable row select in datagrid.
CurrentStyeIndex Gets or sets a value indicating current TableStyle. Default value is -1.
UseGridParentStyle Gets or sets a value indicating whether TableStyles should follow the grid style.

Method Description
OnHeaderClick Raises HeaderClicked event.
OnCurrentRowChanged Raises CurrentRowChanged event.

Event Description
CurrentRowChanged Occurs when current row has changed.
HeaderClicked Occurs when grid header is clicked.

How to use AutoSearch in GridEx

Set AutoSearch property to true during design time or use the following code during runtime:-

this.gridEx1.AutoSearch = true;

During runtime, simple click on the header column that you want to perform search and then type in search value and GridEx will perform incremental search for you. You may use [Backspace] to delete char or [Escape] to clear search value. If you search on DateTime column type, a datetime input box will appear.

Creating Multiple TableStyles

Create styles using datagrid TableStyles Editor. Set the style's MappingName to TableName of DataTable if you want GridEX to load this style first. If none of the styles has MappingName assigned, default style will be used.

Changing TableStyles at Runtime

To change style at runtime, set CurrentStyleIndex to a valid TableStye index.

this.gridEx1.CurrentStyleIndex = 1;

Setting CurrentStyleIndex to -1 will tell GridEx to use default style.


AutoSearch only supports DataTable and DataView datasource. AutoSearch will be turned off automatically if you assign a DataSet to datagrid DataSource property.


I can be reached at


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


About the Author

Web Developer
Malaysia Malaysia
No Biography provided

Comments and Discussions

GeneralCalender Cells Pinmembersashdude1-Oct-08 8:39 
GeneralColumnName with a space PinmemberKC5HHQ12-Jan-07 4:52 
GeneralDisable a column in datagrid PinmemberNdichuw Samuel21-Jun-06 2:05 
GeneralRe: Disable a column in datagrid PinmemberKC5HHQ12-Jan-07 4:51 
GeneralRe: Disable a column in datagrid Pinmemberaltaf sami4-Apr-08 20:15 
QuestionHow i retrive data from Cell [modified] Pinmembersachinjr14-Jun-06 1:40 
AnswerRe: How i retrive data from Cell Pinmemberdanish_bear20-Jun-06 10:32 
GeneralRe: How i retrive data from Cell PinmemberKC5HHQ12-Jan-07 4:54 
AnswerRe: How i retrive data from Cell Pinmemberaltaf sami4-Apr-08 20:19 
GeneralAutosize only works with DataSets, DataTables, and DataViews but not with DataRelations PinmemberJosef Meile8-May-06 10:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 25 Jun 2003
Article Copyright 2003 by cctuan
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid