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. Image for the cookie policy date
close icon

Some question about GridGroupingControl

pic



1、When I click the left and top cell,how to select all the records
2、I binds the column to a List<string>
List<string> list=new List<string>();
list.add("11111");
list.add("22222");
data_GridGroupingControl.TableDescriptor.Columns["col1"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
data_GridGroupingControl.TableDescriptor.Columns["col1"].Appearance.AnyRecordFieldCell.DataSource = list;

I want to prevent the other people from editing the cell's value except they use the dropdown list,how should I set the cell into readonly.

3、I have handled the TableControlCurrentCellShowingDropDown  event 


data_GridGroupingControl.TableControlCurrentCellShowingDropDown += new GridTableControlCurrentCellShowingDropDownEventHandler(data_GridGroupingControl_TableControlCurrentCellShowingDropDown);

  private void data_GridGroupingControl_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
        {
            if (e.TableControl.CurrentCell.Renderer is GridDropDownGridListControlCellRenderer)
            {
                GridDropDownGridListControlCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
             }
         }

How to change the "Object"  text

4、The DropDownList's border  is dotted line,how to change it into solid?

5、How to hide a column?


Thanks!


Attachment: pic_1dae32bc.rar

5 Replies

AR Amal Raj U Syncfusion Team August 5, 2016 12:17 PM UTC

Hi ligyste, 
 
Thanks for using Syncfusion products. 
 
Query 
Response 
 
 
 
 
 
 
When I click the left and top cell,how to select all the records 
In order to select all records in the click of TopLeftHeaderCell, TableControlCellClick can be handled. Table.Records.SelectAll() method is used to select all records. Please make use of the below code. 
 
Code Snippet 
//Event hookup. 
this.gridGroupingControl1.TableControlCellClick += new GridTableControlCellClickEventHandler(gridGroupingControl1_TableControlCellClick); 
 
void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e) 
{ 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    if (style.TableCellIdentity.TableCellType== GridTableCellType.TopLeftHeaderCell) 
    { 
        this.gridGroupingControl1.Table.Records.SelectAll(); 
    } 
} 
 
UG Link 
 
I want to prevent the other people from editing the cell's value except they use the dropdown list,how should I set the cell into readonly. 
To prevent editing, the dropdownstyle must be set to Exclusive for that columns. Please make use of the below code. 
 
Code Snippet 
//to prevent editing and only select options from dropdown. 
this.gridGroupingControl1.TableDescriptor.Columns["CategoryID"].Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.Exclusive; 
 
 
 
 
 
 
How to change the "Object"  text in dropdown gridlistcontrol. 
Column header text in GridListControl can be changed in PrepareViewStyleInfo event of GridListControl. Please make use of the below. 
 
Code Snippet 
//to get GridListControl renderer. 
GridDropDownGridListControlCellRenderer renderer = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; 
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); 
 
//to change GridListControl header text. 
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) 
{ 
    if (e.ColIndex == 1 && e.RowIndex == 0) 
        e.Style.Text = "Text"; 
} 
 
 
 
 
 
 
The DropDownList's border  is dotted line,how to change it into solid? 
Dropdown list border can be changed using PrepareViewStyleInfo event of GridListControl. Please make use of the below code. 
 
Code Snippet 
//to get GridListControl renderer. 
GridDropDownGridListControlCellRenderer renderer = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer; 
renderer.ListControlPart.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(Grid_PrepareViewStyleInfo); 
 
//to change GridListControl header text. 
void Grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) 
{ 
    e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid, Color.LightGray); 
} 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
How to hide a column? 
Solution 1 
Columns can be hided using Cols.Hidden property.Please make use of the below code. 
 
//to hide a column. 
this.gridGroupingControl1.TableModel.Cols.Hidden["Description"] = true; 
 
Solution 2 
Columns can also be hidden by making width of that column = 0. 
 
//to hide a column. 
this.gridGroupingControl1.TableDescriptor.Columns["Description"].Width = 0; 
 
Solution 3 
Columns can be hidden using VisibleColumns.Remove() method also. 
 
//to hide a column. 
this.gridGroupingControl1.TableDescriptor.VisibleColumns.Remove("Description"); 
 
 
Solution 4 
Columns can be hidden using ColHiddenEntries.Add() method also. 
 
//to hide a column. 
GridColHidden hiddenColumn = new GridColHidden(2); 
this.gridGroupingControl1.TableModel.ColHiddenEntries.Add(hiddenColumn); 
 
Solution 5 
If you want to hide an column in runtime, you can hide that particular column by resizing using the Resize indicator. 
 
KB Links 
 
UG Links 
 
Sample Link 
 
Regards, 
Amal Raj U. 



LI ligyste August 6, 2016 01:39 AM UTC

It is very usefull for me,Thank you very much!


AR Amal Raj U Syncfusion Team August 8, 2016 04:18 AM UTC

Hi ligyste, 

Thanks for your update. 

We are glad to know that the given solution has solved your query. Please let us know, If you need any further assistance. 

Regards, 
Amal Raj U. 



RP Ranjani Prabhakaran Syncfusion Team August 8, 2016 04:26 AM UTC

From: ligyste2 [mailto:ligyste2@163.com]
Sent: Friday, August 5, 2016 9:36 PM
To: Syncfusion Support <support@syncfusion.com>
Subject: Re:Syncfusion support community forum 125282, Some question about GridGroupingControl, has been updated.
 

Thank you very much!


RP Ranjani Prabhakaran Syncfusion Team August 8, 2016 04:28 AM UTC

Hi Ligyste, 
 
Please do contact us if you need any technical assistance in future. 
 
Regards, 
 
Ranjani 


Loader.
Live Chat Icon For mobile
Up arrow icon