Click here to Skip to main content
Licence 
First Posted 24 Jun 2003
Views 160,746
Bookmarked 63 times

Enhanced DataGrid control

By | 24 Jun 2003 | Article
Extends DataGrid Functionalities

Sample Image - GridEx.jpg

Introduction

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.

Background

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.

GridEx

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.

Limitation

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

Contact

I can be reached at cheetuan_choong@jabil.com

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

About the Author

cctuan

Web Developer

Malaysia Malaysia

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCalender Cells Pinmembersashdude7:39 1 Oct '08  
GeneralColumnName with a space PinmemberKC5HHQ3:52 12 Jan '07  
GeneralDisable a column in datagrid PinmemberNdichuw Samuel1:05 21 Jun '06  
GeneralRe: Disable a column in datagrid PinmemberKC5HHQ3:51 12 Jan '07  
GeneralRe: Disable a column in datagrid Pinmemberaltaf sami19:15 4 Apr '08  
QuestionHow i retrive data from Cell [modified] Pinmembersachinjr0:40 14 Jun '06  
AnswerRe: How i retrive data from Cell Pinmemberdanish_bear9:32 20 Jun '06  
GeneralRe: How i retrive data from Cell PinmemberKC5HHQ3:54 12 Jan '07  
AnswerRe: How i retrive data from Cell Pinmemberaltaf sami19:19 4 Apr '08  
GeneralAutosize only works with DataSets, DataTables, and DataViews but not with DataRelations PinmemberJosef Meile9:37 8 May '06  
GeneralAutosearch Pinmemberu999nik11:15 6 Nov '03  
GeneralQuerying the database Pinmembersayyedabdulrahim5:35 6 Sep '03  
GeneralWhy "ReadOnly" Pinmemberscampbell117:17 5 Sep '03  
GeneralProblem with AutoSize Pinmemberikos5:47 18 Jul '03  
GeneralAnnouncement !!! Pinmembercctuan15:12 25 Jun '03  
GeneralError running demo project PinmemberDrew Stainton7:43 25 Jun '03  
GeneralRe: Error running demo project PinmemberMichael Choong14:32 25 Jun '03  

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.

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