We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add text in the cell of Grid Dynamic Filter Bar

Thread ID:

Created:

Updated:

Platform:

Replies:

119921 Aug 14,2015 05:07 AM UTC Apr 5,2018 04:30 AM UTC WinForms 10
loading
Tags: GridGroupingControl
Michael K
Asked On August 14, 2015 05:07 AM UTC

Dear Support:

Good day. as I writing a code to add grid grouping control and add dynamic filter in this grid
I would like to the assign the string value in the particular column in Grid Dynamic Filter Bar and also preset the logic function is "Match" during load the grid
For example

gridgroupcontrol1.filterbar.columns[1].text = "peter"
gridgroupcontrol1.filterbar.columns[1].logic = Match


Can I do that ?

Thanks 

Michael

Mahendran Annamalai [Syncfusion]
Replied On August 17, 2015 03:44 PM UTC

Hi Michael,

Thanks for using Syncfusion products.

Setting Filtering for particular column in form loading can achieved by adding modified filtering condition to the particular column as per below code snippet. Changing text in FilterBar  can be done by using gridGroupingControl1.TableControlDrawCellDisplayText .



FilterCondition condition = new FilterCondition(FilterCompareOperator.Like, "Sample data1");

// Add the Condition to the particular Column.

RecordFilterDescriptor rf = new RecordFilterDescriptor("Sample Test", condition);

// Add the RecordFilterDescriptor to the RecordFilters.

this.gridGroupingControl1.TableDescriptor.RecordFilters.Add(rf);


// changing FilaterBar Display Text.

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)

{

    GridTableCellStyleInfo style = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);

    if (e.Inner.ColIndex == 1)

    {

        if ( style.TableCellIdentity.TableCellType == GridTableCellType.FilterBarCell)

        {

            e.Inner.DisplayText = "Sample data1";

        }

    }

}



Sample:   GridGroupingControl_Demo_CS


Please let me know of you have any concerns.



Thanks,

Mahendran.A


Michael K
Replied On August 18, 2015 08:12 AM UTC

Dear Mahendran 


Thanks for your help, will try to do it 

:)

Michael K
Replied On August 18, 2015 09:15 AM UTC

Dear Mahendran  :

One more question , how to focus the filter bar on the form load. That mean, when the windows form open, user can type the text on filter bar without using the mouse to click filter bar instead

Thanks for your help

Michael

Adhikesevan Kothandaraman [Syncfusion]
Replied On August 19, 2015 09:29 AM UTC

Hi Michael,

Thank you for your update.

Query
how to focus the filter bar on the form load. That mean, when the windows form open, user can type the text on filter bar without using the mouse to click filter bar instead
Suggestion 1:
If you want to set the focus to the filter bar cell on Form_Load, you can move the current cell to the specific row, col index. Please refer the below code snippet,

Code snippet:

//Activate the Filterbar cell on form load (RowIndex,ColIndex)
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(3, 1, Syncfusion.Windows.Forms.Grid.GridSetCurrentCellOptions.SetFocus);

Suggestion 2:
If you want to type the text on FilterBar Cell without using mouse click, It can be achieved by using the CurrentCell.Activate() method in DrawCellDisplayText event. Please refer the following code snippet,

Code Snippet:

//Activate the CurrentCell on the Filterbar cell using (RowIndex,ColIndex)
this.gridGroupingControl1.TableControl.CurrentCell.Activate(e.Inner.RowIndex, e.Inner.ColIndex);


Sample:
http://www.syncfusion.com/downloads/support/forum/119921/ze/FilterBarFocus-1198430216

Please let me know if you have any other concern.

Regards,
Adhi.

Michael K
Replied On August 19, 2015 03:15 PM UTC

Dear Adhi:

Thanks for your information, I try to run your sample and find the one problem and don't know how to fix

The problem is that, when I run your sample code, it form load, the cursor locate in the first column of filter bar
There have some record "Sample Data xxx" in column 1, when I type "Sample" in the filter bar , it only show only one character on 1st column of filter bar
If you use mouse to click clear , it return to normal


any idea :) 

Thanks

Adhikesevan Kothandaraman [Syncfusion]
Replied On August 20, 2015 12:43 PM UTC

Hi Michael,

 

Regret for the inconvenience.

 

Please use the second suggestion of my previous update. It will focus the filter bar cell properly and you can have access to type the text in the cell continuously.

 

Code Snippet:

//Activate the CurrentCell on the Filterbar cell using (RowIndex,ColIndex)
this.gridGroupingControl1.TableControl.CurrentCell.Activate(RowIndex,ColIndex);

 

Sample:

http://www.syncfusion.com/downloads/support/forum/119921/ze/FilterBar1068739918

 

Please let me know if you have any  other concern.

 

Regards,

Adhi.


Michael K
Replied On August 21, 2015 02:28 AM UTC

Dear Mahendran :

Thanks for your example, and this sample is what I need

Thanks very much :)



Ranjani Prabhakaran [Syncfusion]
Replied On August 21, 2015 05:53 AM UTC

Hi Michael,
Thanks for the update.
Please let us know if you need any further assistance.
Regards,
 Ranjani

rajat
Replied On April 4, 2018 12:22 PM UTC

Dear Mahendran  :

One more question , how to focus the filter bar on the form load. That mean, when the windows form open, user can type the text on filter bar without using the mouse to click filter bar instead

Thanks for your help

Michael

thanks for book

Sindhu Nagarajan [Syncfusion]
Replied On April 5, 2018 04:30 AM UTC

Hi Rajat, 

Thanks for the update. 

Please let us know if you need any further assistance on this. 

Regards, 
Sindhu

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;