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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem to set width for control GridListControl in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

49925 Sep 29,2006 02:51 PM UTC Oct 4,2006 09:52 AM UTC WinForms 8
loading
Tags: GridControl
Alexander
Asked On September 29, 2006 02:51 PM UTC

I have a problem to set WIDTH for control GridListControl in GridGroupingControl that have to drop down from one of the cells in my grid!!!

A DataTable contains alot of columns and I need to show in drop down control(GridListControl) all them!!!

//********************
//here is the code:
gridGroupingControl1.TableDescriptor.Columns[SupplierInstanceManager.PARENT_ID_DBNAME].Appearance.AnyRecordFieldCell.CellType = "GridListControl";
gridGroupingControl1.TableDescriptor.Columns[SupplierInstanceManager.PARENT_ID_DBNAME].Appearance.AnyRecordFieldCell.DataSource = _localDataTable;

//***************************

So how I can to change width of the showing DropDown Control????

Administrator [Syncfusion]
Replied On October 3, 2006 04:37 AM UTC

Hi Alexander,

For GridListControl cells, you control the width of DropDown by setting the e.Inner.Size property in TableControlCurrentCellShowingDropoDownEventArgs. You control the number of items displayed in the list by setting the DropDownRows property at some point in TableControlCurrentCellShowingDropoDown.

private void gridTableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
if(cr != null)
{
//Setting the Width of the DropDown GridListcontrol
e.Inner.Size= new Size( 300, e.Inner.Size.Height);
//Setting the Height of the DropDown GridListcontrol
((GridDropDownGridListControlPart) cr.ListControlPart).DropDownRows = 2;
}
}

Sample : http://www.syncfusion.com/Support/user/uploads/GridListControlResize_f26be94e.zip

Thanks,
Haneef

Alexander
Replied On October 3, 2006 11:20 AM UTC

I have about 20 column and I need to show them all - and they could not be placed in all screen by width - I don''t want to hide some of one(column)!!!

And in handler
void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)

such code as

GridCurrentCell cc = e.TableControl.CurrentCell;
GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
if (cr != null)
{
//Setting the Width of the DropDown GridListcontrol
e.Inner.Size = new Size(300, e.Inner.Size.Height);
cr.ListControlPart.AllowResizeColumns = false;
//Setting the Height of the DropDown GridListcontrol
((GridDropDownGridListControlPart)cr.ListControlPart).DropDownRows = 5;
((GridDropDownGridListControlPart)cr.ListControlPart).Size = new Size(300,e.Inner.Size.Height);
cr.ListControlPart.Size = new Size(300, e.Inner.Size.Height);
}

can''t help me!!!

if the drop down list(GridListControl) has a width with 20 columns about 2045 pixels - I need to do it width to 700 pixels - and scrolls must be also shown!!!

Administrator [Syncfusion]
Replied On October 3, 2006 12:13 PM UTC

Hi Alexander,

You need to handle the CurrentCellShowingDropDown event and set the width of the dropdown gridlist control using the ColWidths.GetTotal method( It returns the total width of the specified column range). Below is a code snippet

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
if(cr != null)
{
cr.ListControlPart.AllowResizeColumns = false;
int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(0, cr.ListControlPart.Grid.Model.ColCount) + 16;
cr.ListControlPart.Grid.Model.ColWidths.ResizeToFit(GridRangeInfo.Table(),GridResizeToFitOptions.IncludeHeaders);
// testing:
e.Size= new Size( width, e.Size.Height);
}

Sample: http://www.syncfusion.com/Support/user/uploads/GridListControlResize_6a92b80a.zip

Best Regards,
Haneef

Alexander
Replied On October 3, 2006 12:34 PM UTC

It doesn''t help me!!!
I get the width equal 3060 pixels - I need to set the width for example to 700 pixels without to hide the columns

I need for example to write:
e.Inner.Size = new Size(700, e.Inner.Size.Height);

And after that I want to see drop down list(GridListControl) with mentioned size(700x...) and I could to see all my values in columns by scroll to them!!!

I need you help!!!

Best Regards, Alexander.

Administrator [Syncfusion]
Replied On October 3, 2006 12:51 PM UTC

Hi Alexander,

Try this code in CurrentCellShowingDropDown and CellButtonClick event. Below is a code snippet

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
if(cr != null)
{
cr.ListControlPart.AllowResizeColumns = false;
cr.ListControlPart.Grid.DefaultColWidth = 35;

int count = cr.ListControlPart.Grid.ColCount;
for(int i = 1; i<=count ;i++)
cr.ListControlPart.Grid.ColWidths[i] = 35;
e.Size= new Size( 700, e.Size.Height);
}

Thanks,
Haneef

Alexander
Replied On October 3, 2006 01:22 PM UTC

Okey that''s work good, but how can I to show gorizontal scroll bar and to manually change(not in code) when this GridListControl was shown the width of the columns????

Alexander
Replied On October 4, 2006 07:30 AM UTC

I need to ask you one more question!!!
If I have to bind to dropdown control(GridListControl) of my GridGroupingControl a DataTable with 90000 rows - the perfomance is falling down - and when I try to do some actions with my GridGroupingControl - it is work so slowly!!!!

What I have to do or what I have to improve???

Here I bind my DataTable to DropDownControl(GRidListControl):

gridGroupingControl1.TableDescriptor.Columns[SupplierInstanceManager.CANDIDATE_ID_DBNAME].Appearance.AnyRecordFieldCell.CellType = "GridListControl";
gridGroupingControl1.TableDescriptor.Columns[SupplierInstanceManager.CANDIDATE_ID_DBNAME].Appearance.AnyRecordFieldCell.DataSource = ms.dtMasterSuppliers;
gridGroupingControl1.TableDescriptor.Columns[SupplierInstanceManager.CANDIDATE_ID_DBNAME].Appearance.AnyRecordFieldCell.ValueMember = PduInstance.IdFieldName;

Thanks for the help!!!

Administrator [Syncfusion]
Replied On October 4, 2006 09:52 AM UTC

Hi Alexander,

There are also some standard optimizations that let you speed up the grouping engine. Please use these settings and check if they make a difference.

public class GroupingEngine : GridEngine
{
public GroupingEngine()
{
this.CounterLogic = EngineCounters.FilteredRecords;
this.AllowedOptimizations = EngineOptimizations.RecordsAsDisplayElements | EngineOptimizations.DisableCounters | EngineOptimizations.VirtualMode;
TableOptions.VerticalPixelScroll = false;
TableOptions.ColumnsMaxLengthStrategy = GridColumnsMaxLengthStrategy.FirstNRecords;
TableOptions.ColumnsMaxLengthFirstNRecords = 100;
}
}

Sample : http://www.syncfusion.com/Support/user/uploads/ModifiedGridListControlResize_de7aa6af.zip

Thanks,
Haneef

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

;