|
Note: The Visual Studio solution contains a project named GridExtensionUnitTests which requires NUnit to compile. If you don't have NUnit then just remove it from the solution - it is not required if you just want to use the grid.

With the DataGrid, Microsoft has provided a very mighty grid control which has some excellent features. With the possibility to easily add DataViews and customize visualization, the DataGrid is for sure one of the most important controls in the .NET Framework.
This component further extends the functionality of the DataGrid by adding filtering capabilities in an easy, automated and customizable way. The functionality goes beyond the requirements I had in my special case. But I thought it might be a good idea to make something sophisticated which can be used at various places.
Before reading this article, you should know the basics of working with the DataGrid. That's all you need to use this article. To better understand the technical background, you should also be familiar with the concepts of DataViews, RowFilter and DataGridTableStyles.
There are three ways of using this component:
All the three ways are shown in the included examples.
I have put much effort in supplying good samples in the downloads. They cover most of the functionality of this component, so if you want to know what this grid is capable of then play around with them. They depend on the MSAccess Northwind database which can be freely downloaded from Microsoft. At the top of the article you will find a direct download link to this. For easier usage it is also contained in one of the demo project downloads.
Internally the most important class is the GridFiltersControl. It builds up the filter criteria and contains the filter controls (unless they are customized). Most of the functionality is placed within it. Then there is the DataGridFilterExtender which binds a DataGrid or ExtendedDataGrid to a GridFiltersControl. How the columns are filtered and what GUI has to be shown is defined in the IGridFilter implementations which are created by an IGridFilterFactory. The FilterableDataGrid class is finally a composition of all those classes which allows a quick start.
The following sections contain some more information on the classes within this component. For a more detailed information just look at the fully commented code or have a look into the compiled help file contained in the downloads.
This class is derived from DataGrid. Its main extension is that it provides a property AutoCreateTableStyles to automatically create table styles. This is done whenever the DataSourceChanged event occurs and no appropriate table style is found. Furthermore, it publishes some protected properties from the DataGrid which are normally not accessible from outside.
This is the basic interface describing how a column can be filtered. For this it defines the GUI elements and the textual representations of the filter criteria.
IGridFilter implementations
All the given implementations of IGridFilter derive from the abstract class GridFilterBase, which is like all the concrete implementations located in the GridExtensions.GridFilters namespace. When making your own filters I would recommend using this base class as it reduces the amount of work to be done to get a working filter.
I have provided the following implementations of the IGridFilter:
TextGridFilter
TextGridFilter can filter about every column. It uses a like criterion to filter rows beginning with a specified text. The filter is set with a simple TextBox control.
BoolGridFilter
BoolGridFilter is an implementation for boolean columns. The filter is set with a CheckBox control with three states. The intermediate state means no filter is applied. The other states will filter out the rows not having the specified value.
NullGridFilter
NullGridFilter is an implementation which works on columns of any type. The filter is set with a CheckBox control with three states. The intermediate state means no filter is applied. The other states will filter out the rows which contain / not contain DbNull.
Implementing this one was a bit tricky as there is no direct filter expression to filter out rows with DbNulls. The filter expression I generate for the columns look like the following: Convert(ISNULL([ColumnName], 'a§df43dj§öap'),
System.String) = 'a§df43dj§öap'
The weird string is just made up by me. I hope no one will use this one actually as a value in a grid, because this would result in wrong results (it would be shown as a DbNull value).
NumericGridFilter
The NumericGridFilter is an implementation for numeric columns. It uses a NumericGridFilterControl which consists of a ComboBox containing * and several comparison operators (>, =, ...) and a TextBox. When the ComboBox is set to *, the filter behaves like a TextGridFilter. Otherwise the text in the TextBox will be converted to a numeric value and the data source will be filtered to match the comparison criterion. If no valid number is given this filter will filter out all the rows.
DateGridFilter
Nearly the same as the NumericGridFilter class, but it builds the filter criteria for DateTime columns and has a DateGridFilterControl consisting of a DateTimePicker instead of a normal TextBox control.
EnumerationGridFilter
EnumerationGridFilter is an implementation for columns containing a list of distinct values. The filter is set with a ComboBox control which is filled with those values. Which values are set to the list and how to build a filter for them is defined by a customizable IEnumerationSource implementation. I have provided two default implementations:
TypeEnumerationSource
This implementation will get all the members of a given enumeration type and fill the ComboBox with them. For this to work, the DataColumn must have the same type as the enumeration type given here.
IntStringMapEnumerationSource
Here, a user defined mapping between the string values (which are shown in the ComboBox) and the integer values contained in the data source can be defined.
DistinctValuesGridFilter
The DistinctValuesGridFilter analyzes a column for its contained values, and fills a ComboBox with these along with a (*) and a (null) (only if the column contains DbNull) entry. The user can then select from any of those distinct values to filter accordingly. Using this type of IGridFilter with large data sources might lead to a performance loss at startup. Look into the description of the DefaultGridFilterFactory for further explanations and restrictions.
EmptyGridFilter
This one is just a dummy implementation to allow switching off the filter functionality for certain columns.
This is a simple interface which provides a method to create an IGridFilter for a specified column. I included this interface to provide maximum flexibility. It could, for example, be used to specify special filters for each column separately.
Instead of having to implement your own IGridFilterFactory for every special case, it is also possible to extend an existing implementation by binding its GridFilterCreated event. It provides information about the table, name and the type of the column for which an IGridFilter is being created and also the instance provided by the factory. The handler of the event can then exchange the IGridFilters for the needed columns. This is, for example, useful when you want to define an EnumerationGridFilter with a customized IntStringMapEnumerationSource to a special column while leaving all other columns as they are.
IGridFilterFactory implementations
Three implementations of this interface are provided within this component (all are located in the GridExtensions.GridFilterFactories namespace). Another one can be found in the samples. They not only provide how the columns are filtered but also where the filtering GUI is located. The included implementations are:
DefaultGridFilterFactory
This implementation of IGridFilterFactory will be automatically generated and used by the FilterableDataGrid. It automatically provides valid implementations for the various data types which can be contained in a DataTable.
The creation process consists of these steps:
- If the column data type is an enumeration and
HandleEnumerationTypes is set to true, then an EnumerationGridFilter is created.
- If
CreateDistinctGridFilters is set to true, then it is analyzed if the column contains less or equal distinct values than specified by MaximumDistinctValues. If yes, then a DistinctValuesGridFilter is created. The MaximumDistinctValues property is not only important to reduce the maximum number of entries the ComboBox gets filled with, but also to improve performance because the analysis of the columns data will be stopped immediately when more values are found than specified by it, and thus the analysis doesn't have to search through the whole data source.
- If a grid filter type is specified for the data type of the column, then this one will be created. The data type to grid filter type matching can be altered by calls to
AddGridFilter and RemoveGridFilter. Note that, only grid filter types which implement IGridFilter and which have an empty public constructor are allowed.
With this little example, one could switch off the filter functionality for columns of type DateTime: myDefaultGridFilter.RemoveGridFilter(typeof(DateTime));
- If still no filter was created, then the filter specified by
DefaultGridFilterType will be created. By default, this is the TextGridFilter. Note that, again only grid filter types which implement IGridFilter and which have an empty public constructor are allowed.
NullGridFilterFactory
This implementation of IGridFilterFactory always generates NullGridFilters no matter what column was specified.
DistinctValuesGridFilterFactory
This implementation of IGridFilterFactory always generates DistinctValuesGridFilters no matter what column was specified.
FullTextSearchGridFilterFactoryTextBox
This implementation derives from TextBox and builds a TextGridFilter for each column supplying itself as the TextBox to fetch the criterion from. The effect is that all the columns are filtered by the contents of just one single TextBox. This is even possible in several grids simultaneously. To use it just drag it onto the form with the FilterableDataGrid or GridFilterExtender and set the FilterFactory property via designer to this class.

LayoutedFridFilterFactoryControl
This implementation is build upon the DefaultGridFilterFactory or any other IGridFilterFactory implementation. What kind of IGridFilters are created is determined by this inner factory but this implementation customizes the location of the filter GUI in a layouted way - outside of the actual grid. To use it just drag it onto the form with the FilterableDataGrid or GridFilterExtender and set the FilterFactory property via designer to this class.

This internal class should be of no matter to you if you are only using this library. This is the control which is placed above, beyond or within the DataGrid which is extended. It holds all the extra controls from the current IGridFilters which have not set its UseCustomPlacement property to true. It also contains most of the filter building logic of this component.
Now we come to the core class of the library. I have documented all the public properties and methods very well so I won't go too far into the details here. The most important properties are:
DataSource
This property has to be used to set the initial DataView. The grid is not limited to that one. If the DataView is, for example, part of a complex DataSet, it is possible (like in the normal DataGrid) to navigate through its relations. The only limitation (as mentioned above) is that an appropriate DataGridTableStyle must exist.
EmbeddedDataGrid
With this property, the underlying grid can be accessed. With this, all the properties of the normal DataGrid can be altered. This is not possible with the designer (here, you will have to use the extended grid itself). The extra property AutoCreateTableStyles can also be set here (if you are too lazy to define your own).
FilterBoxPosition
Use this property to specify where the filter GUI should appear.
FilterFactory
If you want, you can specify your own implementation of the IGridFilterFactory with this property.
AutoAdjustGridPosition
This property will adjust the position of the grid depending on where the filters are displayed. This will not work if the grid is docked in any way (anchors are fine).
All other properties can be explored by yourselves.
This control is nothing more than a UserControl which binds the ExtendedDataGrid and the DataGridFilterExtender together. For every new filterable grid you want to create, this should do the job without having to handle several components.
I finally made a DataGridView version of this component which is called DataGridViewExtensions. The solution is logically a Visual Studio 2005 solution while the DataGrid solution is still 2003. It has most of the functionality of the original component. The missing parts and known issues are:
- The highlighting is not yet contained.
- NDoc documentation is not yet contained.
- Because the
DataGridView doesn't have a header, the corresponding value in the FilterPosition enumeration has been removed.
- Changing
RightToLeft while the filters are visible will result in heavy flickering. This shouldn't (hopefully) be a problem because I assume this property is normally not changed while the grid is shown.
- Startup performance might be bad when setting the
DataSource in the constructor of the Form/Control the DataGridView is contained in. A simple workaround is to set the DataSource in the overridden OnLoad method after the base call.
- As you can see in the history section I'm eager to extend this component with useful features requested here. So, if anyone has further suggestions, please feel free to post them here.
- March 26th, 2005
- March 26th, 2005
- (Some hours later) Refactored the library so that a component can be used to easily extend the existing grids. This will solve the problem of having to manually set the properties and bind the events in the nested
DataGrid.
- March 31st, 2005 - Several enhancements and fixes were made:
- The component can now work with normal
DataGrids. Thus the use of the ExtendedDataGrid is no longer necessary. The only requirement is that an appropriate DataGridTableStyle must be created and added to the grid. For this, the new helper class DataGridStyleCreator has been added.
- New property
AutoAdjustGridPosition for automated repositioning of the grid added.
- Fixed bug in the property
AutoCreateTableStyle.
- Fixed bug when removing the
DataGridExtender component from its assigned Form.
- Added automated change of colors of the filter GUI when the colors of the underlying controls or the grid change.
- Added handling of the
CaptionVisible property of the DataGrid. This is important as a caption is needed in some display modes.
- Added handling of change events from the style collections to immediately reflect changes in the filter GUI.
- April 9th, 2005 - Some enhancements and fixes:
- Added the
DateGridFilterControl to allow better filtering of DateTime columns.
- Corrected some minor mistakes in my comments.
- Added some attributes for (a bit) clearer design time support.
- April 11th, 2005 - Some enhancements and fixes:
- Added the
EnumerationGridFilter to allow user friendly filtering of columns containing enumeration types.
- Fixed an error regarding criteria string building. Thanks to Juergen Posny for pointing this out.
- Moved all the
IGridFilter implementations to a separate namespace (GridExtensions.GridFilters).
- Added a
ComboBox to the main form to allow the user to select what data should be presented from the Northwind database. Also, added an enumeration type column programmatically to show the functionality of the newly added EnumerationGridFilter.
- April 15th, 2005 - Some enhancements:
- Added a property
Operator to allow definition if the criteria is combined with a logical AND or a logical OR.
- Added a method
ClearFilters to clear all the set filters to their initial state.
- April 16th, 2005 - Some enhancements and fixes:
- Corrected the wrong appearance of the filters when the
RowHeadersVisible property of the DataGrid was set to false. Thanks to Dean_DWD for pointing out this.
- Added two properties
MessageErrorMode and ConsoleErrorMode that allow configuring the kind of output that is generated when an error occurs in the built filter criteria.
- May 14th, 2005 - Some fixes:
- Corrected some bad behaviour when using
AutoAdjustGridPosition with anchored grids, which could screw up the designer in certain situations.
- Corrected a special situation where a wrong filter criteria was created.
- October 3rd, 2005 - Some enhancements and fixes:
- Corrected typo of several
ScrollBar properties. Thanks to Goyuix for pointing this out.
- Changed the
EnumerationGridFilter so that it is easier to build customized value list filters. This is based on a request made by Thomas-H.
- Added the
GridFilterCreated event to the IGridFilterFactory class to allow easy modifications to the filter behaviour of single classes (mainly needed for the new functionality in EnumerationGridFilter).
- Created a new startup form from where one can start three demo forms showing most of the functionality of this component.
- Minor corrections of code formatting.
- November 19th, 2005 - Some enhancements and fixes:
- Added strict usage of [] around the column names in the filter building process. This should eliminate issues regarding extravagant column names.
- Added a
SetFilter function to IGridFilter which is basically the reverse version of GetFilter. With the help of this, I could add the function Get/SetFilters to both DataGridFilterExtender and FilterableDataGrid, which can save/load the whole filter configuration. I made this based on a request from Ken Dreyer.
- To make the last point easier to implement, I changed the whole logic of building filters by using
string.Format and regular expressions, which should make the whole process a bit cleaner.
- Added some unit tests to automatically test the new
Get/SetFilters functions.
- Added an event
FilterChanged so that one can get a notification whenever the filter criterion is changed (by the extender not the DataView itself).
- December 7th, 2005 - Version 2.0:
- I've made so many changes that I think it's worth a new version. From now on I will try incrementing the version with every bug fix or enhancement.
- Changed the
CreateGridFilter function of the IGridFilterFactory to allow easier customization of the filter creation process (sorry for any broken custom implementations).
- Refactored the
IGridFilter implementations to make use of a common GridFilterBase class and also separated the GUI of the NumericGridFilter and DateGridFilter from the filtering logic.
- Filter controls are now allowed to be placed outside of the grid and are independent of the created
IGridFilters. This is used by the new IGridFilterFactory implementations (like the FullTextSearchGridFilterFactory based on a request from Carlso) and generally gives a huge bunch of new possibilities for customization.
- Some namespace refactorings.
- A new property
AutoRefresh accessible in the GridFilterExtender or FilterableDataGrid. For very large tables this property can be set to false after which the view will not get updated with every change to the filter controls until RefreshFilters is called or AutoRefresh is set to true again.
- Added some more support and descriptions for the designer.
- Included compiled help file in the downloads. An NDoc project file is also included containing the settings to build the help file as well as a HTML documentation (which is not included in the downloads).
- Several minor bug fixes and refactorings.
- January 14th, 2006 - Version 2.1:
- Added a new property
GridMode which controls whether the grid is filtered or matching rows just get highlighted. This is based on a request from Muhammad Waqas Butt.
- To achieve the highlighting I added the new class
DataFilter which wraps the internal DataFilter class contained in the .NET Framework. Because this class is internal I needed to build a wrapper which uses it with reflection mechanisms.
- Corrected LeftToRight behaviour which was totally screwed up. Thanks to arashr for pointing this out.
- April 22nd, 2006 - Version 2.2:
- Fixed that the
HandleEnumerationTypes property on the DefaultGridFilterFactory was ignored.
- Fixed that the
SetFilters and GetFilters calls would sometimes not work on BoolGridFilters.
- Added a new
IGridFilter implementation with the name NullGridFilter and a corresponding factory named NullGridFilterFactory. This is based on a request from HITMUS.
- Added a new
IGridFilter implementation with the name DistinctValuesGridFilter and a corresponding factory named DistinctValuesGridFilterFactory. Also added functionality to the DefaultGridFilterFactory to allow usage of this filter in standard situations. This is based on a request from HITMUS and anandcts.
- Extended Sample1 to show the new functionalities.
- Wrote some more unit tests.
- May 7th, 2006 -
GridViewExtensions - Version 1.0:
- Added a
DataGridView version of the component, and a new section in the article shortly describing it.
- May 20th, 2006 - GridViewExtensions 1.1 - GridExtensions 2.2:
- Added support to more easily change the filter settings programmatically. This was already in my head several weeks, and because of a request from rEgEn2k, I finally implemented it. In detail, the changes are:
- Public properties on all
IGridFilter implementations to get and set the current settings.
- A
GetGridFilters function which returns all the currently shown IGridFilters. The returned collection class has functions to filter by type and access IGridFilters by several means.
- Added a
TextBox along with a Button to Sample 1 which demonstrates how to set all the values on IGridFilters of a special type.
- June 5th, 2006 - GridViewExtensions 1.2 - GridExtensions 2.3:
- Added a new operator for date and numeric columns to filter for values in between two given values. When selected, two
DateTimePickers/TextBoxes will appear and wait for user input. This functionality is by default off, and can be explicitly turned on every filter separately, or by setting either DefaultShowDateInBetweenOperator or DefaultShowNumericInBetweenOperator on the DefaultGridFilterFactory. Many thanks to Luis Carlos Gallego on this one. He not only provided the idea but also most of the code for this.
- Added four properties:
BaseFilters, BaseFilterEnabled, BaseFilterOperator, and CurrentTableBaseFilter. With them, it's possible to define a filter criteria which gets concatenated with the filter criteria generated by the control before applying it as a row filter. Again thanks to Luis Carlos Gallego for providing the idea and some code.
- Added several unit tests (only
DataGrid version) for the 'in between' regular expressions, and reorganized them into several files because the old one just got too big (a total of 87 tests now integrated).
- July 2nd, 2006 - GridViewExtensions 1.3:
- Added support for using
BindingsSources and DataSets which can now be directly assigned to the DataSource property of the DataGridView. Furthermore, the DistinctValuesGridFilter can now work with such data bindings. Thanks to smatusan and Aventura for pointing that out and also helping me with the implementation.
- Fixed a bug in the
DateGridFilter. Thanks to macus for reporting.
- October 1st, 2006 - GridExtensions 2.4:
- Fixed bug where a manual call to
RefreshFilters wouldn't show the desired results when there are no filters currently set.
- Added redirection of events from the embedded grid of the
FilterableGrid so that they can be used within the designer as you would normally do. I've done this for MouseDown, MouseUp, MouseMove, MouseEnter, MouseLeave, MouseHover, KeyUp, KeyDown, and KeyPress. This is based one a request made by Marcelo Miorelli. All other events can be reached by using the EmbeddedDataGrid property. If someone needs more than this, feel free to post requests.
- Replaced the property
AutoRefresh with AutoRefreshMode which now allows several settings instead of only on/off. This includes refreshing the filter only when pressing Enter and/or when the focus leaves a filter control. This is based on a request made by georg_werner. Added a new combo box to the first sample to test this.
- Some minor code reorganization.
- October 1st, 2006 - GridViewExtensions 1.4:
- Added the same enhancements as in the GridExtensions.
- Added full support for any data source implementing
IBindingListView. The only requirement is that it must allow complex filters.
- Added a
IBindingListView implementation which works as a wrapper around any given IList. Thus, this component now also works with list classes. Because of this implementation, sorting on lists is now supported by the grid. Have a look at the new sample 6 to see how this works. This feature was requested by several users, so I hope you'll appreciate it. As I haven't tested this in any real world scenario, I'll need feedback if it lacks something.
- October 15th, 2006 - GridViewExtensions 1.4.1:
- Fixed a bug reported by georg_werner where an internal refresh wouldn't apply the correct filtering to the grid when all contents were deleted from the filter controls.
- November 18th, 2006 - GridViewExtensions 1.5 and GridExtensions 2.5:
- Fixed bug that the
BaseFilterEnabled property was ignored. Thanks again to georg_werner for reporting and even fixing the bug.
- The
DoubleClick event should now function as expected in both FiltarableGrid and FiltarableGridView.
| You must Sign In to use this message board. |
|
| | Msgs 1 to 25 of 338 (Total in Forum: 338) (Refresh) | FirstPrevNext |
|
 |
|
|
Dear Robert I'm a developer at a Railway Signaling & Telecommunication Systems company. I would like to thank you for this gem component. I want to inform you that we are using this nice component in one of our applications.
Regards, Reza K.(rezaka at gmail dot com)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Amazing work. How I can get the expresion filter to send it to the Data Access Layer and requery the server data..?
best regards
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
we have been using this control now for about a year and it has been extremely useful, flexible, and robust...thank you so much for all of the great work you put into creating this fantastic tool!
the main dgv used in our app has a number of columns which the user is allowed to edit by way of a right-click context menu list. this works perfectly when the cells being edited are not in the column on which a filter is active. a foreach is used to loop through the selectedrows collection and update each cell according to the users choice from the list. however; just recently a scenario has come to our attention where the user attempts to change cells in the filtered column and the selectedrows collection somehow gets confused and an exception is thrown (index out of range and the index is set to -1) when the call to change the cell value is made: <pre> foreach (DataGridViewRow dgRow in dgvTemp.SelectedRows)function String() { [native code]} {function String() { [native code]} rowIndex = (int)dgRow.Index;function String() { [native code]} colIndex = (int)dgRow.Cells[PRIORITY].ColumnIndex;function String() { [native code]} dgRow.Cells[PRIORITY].Value = newPriority; function String() { [native code]} //change the font color to denote pending editsfunction String() { [native code]} dgRow.Cells[PRIORITY].Style.SelectionForeColor = colDataChanged; function String() { [native code]} }//foreach </pre>
this code works fine without a filter, as well as for columns that are not the filtered column, regardless of which column is filtered and which column is edited. it is just when the cells in the filtered column are changed does this problem occur.
what could be causing this to occur?
thanks
kjward
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
o.k., i think i may have figured out why this is happening...it is one of those homer simpson "d'oh" moments. apparently the grid-filter doesn't like it when you try to update a filtered column cell with a value that does not meet the filter criterion. round peg, square hole kinda thing, eh?
the strange part is it will let you get away with changing one row, but try any more and it complains. it seems to eliminate the first row from the selectedrows collection and then the second attempt fails because it has lost its place in the foreach collection.
yes, there are various work-arounds, depending on your specific business rules, etc. like limiting changes to single rows at a time, not using the selectedrows collection to update the selected rows, forcing the user to remove the filter before changing multiple rows, yada yada...
in the end, the filter is doing precisely what is expected and continues to be a tour-de-force of programming skill. thanks again to robert for his brilliant contribution.
kjward
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello I am a newcomer so maybe I missed some comments and notes about this project, so basically what am I asking is how hard would be to implement simple printing in hole concept?
Or just what are the aspects on that?
I think I saw some comments on printing idea, but there was no response...
P.S I am impressed with this project and I just think that adding printing functionality would bring it to NEXT level.
|
| Sign In·View Thread·PermaLink | 3.00/5 (1 vote) |
|
|
|
 |
|
|
Hi there
I have improved the EnumerationGridFilter a little bit and thought I should share it with the rest of the world.
In EnumerationGridFilter.cs locate the constructor on line 51 and add the following lines
_combo.AutoCompleteSource = AutoCompleteSource.ListItems; _combo.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
Now it finds the appropriate rows while you type. I assume this could have an impact on performance. But I think it wouldn't be much of a problem to prevent this (with timeouts or something)
Secondly I added an KeyDown EventHandler
private void _combo_KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.Escape) { _combo.SelectedIndex = 0; } }
Now, if you type Esc while you're in the ComboBox it will "reset" the filter.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
You should set AutoCompleteMode to AutoCompleteMode.Append only.
AutoCompleteMode.SuggestAppend worked most of the time, but on some DataGridViews it caused really weird behaviour.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi, great control works fine. Now I have to group some rows. How can I do this like the picture above from sample 3 ?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
hi
thanks for the demos
is it possible that u show me part of the code that relate to filtering fuction and how to link comboBox with the datagrid??
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Is it possible to force a specified DataGridColumn to have a DistinctValuesGridFilter (without setting the MaximumDistinctValues)?
Thanks in advantage.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
your article is so good, but im new to .net
But I have several problems with datagrid.
how to summarise perticular datagrid column data into text box?
suppose we have data grid with columns (InvoiceID, description,Date, Price) I want to get the sum of the price(Datagrid column data) to the textbox that appear on same vb.net form.
how can i do? Please expain using vb.net source codes?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello, You can do that by tapping the datagrid's datasourcechanged event. You can write code to read through all the rows and sum the values in the price column. Following code is an example.
dim TotalPrice as short for i as integer=0 to datagrid1.rows.count-1 totalprice += short.parse(datagrid1.rows(i).cells("Price").value) next
Hope it helps.
Regards, Nasir
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
This is a wonderful and highly useful tool. I have been looking for just this solution for a while, and this was simple to add to my existing code, with only the most trivial of code changes. Thank you!
Would it be possible to add another item at the bottom of the grid? It would look much like the filter, but would simply total up the numeric columns, and otherwise be blank. The totals would update in real time as filters are applied to the grid.
Cheers, Daniel Williams
@ Daniel Williams, PhD, MCSD @ Sr Integration Engineer @ AniWorld, Inc. @ www.aniworld.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi,
Amazing work. Really a very useful control.
I am pretty new to .Net development, and my current application needs few additional functionality to be added like:
- Adding check box, and hyper link columns to the grid - Conditional formatting of grid data
Could you plase let me know how I can add these fucntionalities to your control.
Regards, Raja
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
In one WinsForm, i have a order list shows on a datagrid (typed dataset). When double click on one of the selected item name, a new WinsForm is shown, with details of that item being ordered (a row of table will be created). If i modify the contents of this row in this page, say changing the buying quantity, how can this info be passed back and shown on the previous form?
If i add new or modified the row of a table, how can i merge this new or modified row back to the dataset?
Thank you.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
In one WinsForm, i have a order list shows on a datagrid (typed dataset). When double click on one of the selected item name, a new WinsForm is shown, with details of that item being ordered (a row of table will be created). If i modify the contents of this row in this page, say changing the buying quantity, how can this info be passed back and shown on the previous form?
If i add new or modified the row of a table, how can i merge this new or modified row back to the dataset?
Thank you.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I voted 5 this article. Your work is great!! I only noticed some points to be implemented in order to have a very powerful tool: 1) When I use the DistinctValuesGridFilterFactory, text strings in combo boxes are truncated and often I can't distinguish an item like "Aaaaaaaaaa 1" from the item "Aaaaaaaaa 2"; it'd be great to have autosized dropdown list for the combo boxes.
2) Using the DistinctValuesGridFilterFactory, it'd be very useful to have a check box for each item in combo boxes in order to filter one or more items in the same combo box (with the OR operator)
Thank you for giving us this wonderful tool!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
| | |