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.
Unfortunately, activation email could not send to your email. Please try again.

Assign value on filter record

Thread ID:

Created:

Updated:

Platform:

Replies:

125009 Jul 14,2016 05:54 AM Jul 19,2016 02:27 AM Windows Forms 3
loading
Tags: GridGroupingControl
Michael K
Asked On July 14, 2016 05:54 AM

Hi All :

Good day, today, I have write a code for GridGroupControl as below:

GridDynamicFilter GridDfilter = new GridDynamicFilter();

gcAcSelect.TableDescriptor.Columns["ac_Select"].MappingName = "Chk";
                gcAcSelect.TableDescriptor.Columns["ac_Select"].Appearance.AnyRecordFieldCell.CheckBoxOptions.CheckedValue = "1";
                gcAcSelect.TableDescriptor.Columns["ac_Select"].Appearance.AnyRecordFieldCell.CheckBoxOptions.UncheckedValue = "0";
                gcAcSelect.TableDescriptor.Columns["ac_pNum"].MappingName = "ProductNum";
                gcAcSelect.TableDescriptor.Columns["ac_pNum"].AllowFilter = true;
                gcAcSelect.TableDescriptor.Columns["ac_pName"].MappingName = "ProductName";
                gcAcSelect.TableDescriptor.Columns["ac_pName"].AllowFilter = true;
                GridDfilter.WireGrid(gcAcSelect);

Above code that will show filter bar on Grid Grouping Control, then I create the 2 button which name "select all" and "clear all"
When user click select all, all filtered record will be check
The code as below
private void cmdAcAll_Click(object sender, EventArgs e)
        {
            foreach (Record rec in gcAcSelect.TableControl.Table.Records)
            {
                rec.SetValue("Chk", 1);
            }
        }

My problem is, when user click the select all button, the  unfiltered record are also be checked (i.e. Chk value = 1), how can prevent it ?

Pls advice

Thanks

Michael

Piruthiviraj Malaimelraj [Syncfusion]
Replied On July 18, 2016 03:01 AM

Hi Michael, 

Thanks for using Syncfusion products. 

We had analyzed your sample code. It seems that , you have used Table.Records collection to achieve your scenario. The Records collection will maintain the whole records of grid table (i.e. Filtered and unfiltered records). To achieve your scenario, FilteredRecords property of TableControl can be used. Because FilterRecords property will maintain the all the filtered records. Please make use of the below code. 

Code snippet 

private void button1_Click(object sender, EventArgs e) 
    foreach (Record rec in gridGroupingControl1.TableControl.Table.FilteredRecords
    { 
        rec.SetValue("CategoryID", 1); 
    } 

Sample link 

Regards, 
Piruthiviraj 


Michael K
Replied On July 18, 2016 04:41 AM

Dear Piruthiviraj:

Your message well note with thanks

Michael

Piruthiviraj Malaimelraj [Syncfusion]
Replied On July 19, 2016 02:27 AM

Hi Michael, 

Thanks for your update. 

Please let us know if you need any further assistance. 

Regards, 
Piruthiviraj. 


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.

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.

;