SA
Saravanan A
Syncfusion Team
May 9, 2007 04:03 PM UTC
Hi Ryan,
You can achieve this by setting the TableDescriptor.FrozenColumn property to the name of the first column.
Here is the code snippet.
this.gridGroupingControl1.TableDescriptor.FrozenColumn = "ColumnName";
Best Regards,
Saravanan
RH
Ryan Hardoon
May 10, 2007 12:31 PM UTC
Thanks, that's exactly the behavior I need :)
Now all I need is to prevent the frozen column from being resized.
Is it possible to identify the name of the column to be resized from within TableControlResizingColumns, or is there a similar settings (like: ".FrozenColumn =") that does the job ?
HA
haneefm
Syncfusion Team
May 10, 2007 07:11 PM UTC
Hi Ryan,
You can use this code to get column name in a TableControlResizingColumns event.
private void gridGroupingControl1_TableControlResizingColumns(object sender, GridTableControlResizingColumnsEventArgs e)
{
int iColIndex = e.Inner.Columns.Left;
int iField = e.TableControl.TableDescriptor.ColIndexToField(iColIndex);
if( iField >= 0 )
Console.WriteLine( e.TableControl.TableDescriptor.Columns[iField].Name);
}
Best regards,
Haneef
JG
James Gramosli NO LONGER WITH COMPANY
January 4, 2008 10:56 AM UTC
The above code does not seem to work, its returning different columns than the one selected in my grid. We're using a combination of Bound Fields, and 2 Unbound action fields in a hierarchy(2 GridTables).
JG
James Gramosli NO LONGER WITH COMPANY
January 4, 2008 11:19 AM UTC
There is a bug in the code you guys provided, if parent and children table have different column counts, you need to do a check for the index being valid as this event is still fired for columns which are not there. There is a few versions of this code on your forums, I suggest you update all of the threads with the right code...
if ( e.Inner.Columns.IsCols)
{
int colIndex = e.TableControl.TableDescriptor.ColIndexToField(e.Inner.Columns.Left);
if(colIndex < e.TableControl.TableDescriptor.VisibleColumns.Count && e.TableControl.TableDescriptor.VisibleColumns[colIndex].Name == "Whatever" )
e.Inner.Cancel = true;
}
JJ
Jisha Joy
Syncfusion Team
January 9, 2008 06:58 AM UTC
Hi James,
Thank you for your suggestion.
Thank you for your interest in Syncfusion Products.
Regards,
Jisha