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.
Syncfusion Feedback

Urgent ! Extra Space in Grid & Sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

64774 Jul 24,2007 07:05 AM UTC Sep 5,2007 06:10 AM UTC Windows Forms 15
loading
Tags: GridControl
Gourav Nayyar
Asked On July 24, 2007 07:05 AM UTC

hi
i am using Syncfusion Grid Control for my data but there are following issues comes :-
1) Extra space comes after last column , how can we remove that just see screenshott.
2) and i'm using gridcontrol but i have to use grid sorting but that's not comes in my grid by default.

pl'z suggest abou that as soon as possible

Thanks in advance
Gourav


space0.zip

haneefm [Syncfusion]
Replied On July 24, 2007 03:16 PM UTC

Hi Gourav,

1) Extra space comes after last column , how can we remove that just see screenshott.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You need to resize the columns to fit over the grid's client area, by handling Grid.Model.QueryColWidth event as explained in these Knowledge Base(KB) articles:

1) How can I have my grid auto adjust column widths so that the columns completely fill the grid''s client area
2) Helper class to support percentage sizing in GridControl/GridDataBoundGrid

2)i'm using gridcontrol but i have to use grid sorting but that's not comes in my grid by default.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The GridControlSort browser sample shows you how to add header-click sorting to your grid. The header cell draws a sort icon to indicate that the column has been sorted in a particular direction.

Here is a path.
[Instal drive]: \Program Files\Syncfusion\Essential Studio\4.3.0.0\windows\Grid.Windows\Samples\Quick Start\GridControlSort

Click the syncfusion Browser Sample=>Essetail Studio samples => GridSamples => QuickStart => GridControlSort

See this forum thread for more details.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=42928

Best regards,
Haneef

Gourav Nayyar
Replied On July 25, 2007 07:39 AM UTC

Thanks in advance
i got ur solution for query no. 1
that for removing extra space i'll use gridcolsizehelper , but i did'nt want to add extra class in my code. pl'z suggest me another way to remove the space , means by using syncfusion properties or something else.

>Hi Gourav,

1) Extra space comes after last column , how can we remove that just see screenshott.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
You need to resize the columns to fit over the grid's client area, by handling Grid.Model.QueryColWidth event as explained in these Knowledge Base(KB) articles:

1) How can I have my grid auto adjust column widths so that the columns completely fill the grid's client area
2) Helper class to support percentage sizing in GridControl/GridDataBoundGrid

2)i'm using gridcontrol but i have to use grid sorting but that's not comes in my grid by default.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The GridControlSort browser sample shows you how to add header-click sorting to your grid. The header cell draws a sort icon to indicate that the column has been sorted in a particular direction.

Here is a path.
[Instal drive]: \Program Files\Syncfusion\Essential Studio\4.3.0.0\windows\Grid.Windows\Samples\Quick Start\GridControlSort

Click the syncfusion Browser Sample=>Essetail Studio samples => GridSamples => QuickStart => GridControlSort

See this forum thread for more details.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=42928

Best regards,
Haneef

space1.zip

haneefm [Syncfusion]
Replied On July 25, 2007 11:11 PM UTC

Hi Gourav,

You can resize the columns and rows to fit over the grid's entire area, by handling the Grid.Model.QueryColWidth and Grid.Model.QueryRowHeight respectively. Below are the code snippets that helps in doing this.

private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
{
int clientwidth = this.gridDataBoundGrid1.ClientRectangle.Width - this.gridDataBoundGrid1.Model.ColWidths[0];
e.Size = (int)(clientwidth / (float)this.gridDataBoundGrid1.Model.ColCount);
e.Handled = true;
}
}

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
{
int clientheight = this.gridDataBoundGrid1.ClientRectangle.Height - this.gridDataBoundGrid1.Model.RowHeights[0];
e.Size = (int) ( clientheight / (float) this.gridDataBoundGrid1.Model.RowCount );
e.Handled = true;
}
}

Best regards,
Haneef

Gourav Nayyar
Replied On July 26, 2007 07:08 AM UTC

hi Thanks for your solution, but still i am at the same position from where i start. thing is that you sent me the sample codes of GridDataBoundGrid , but i tell you that i am using the simple GridControl not GridDataBoundGrid Control , so please send me the solution according to Syncfusion GridControl ( Syncfusion.Windows.Forms.Grid.GridControl) and pl'z send me early as soon as possible and for Sort Query also sen me the solution .

Thanks in Advance

Gourav

>Hi Gourav,

You can resize the columns and rows to fit over the grid's entire area, by handling the Grid.Model.QueryColWidth and Grid.Model.QueryRowHeight respectively. Below are the code snippets that helps in doing this.

private void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
{
int clientwidth = this.gridDataBoundGrid1.ClientRectangle.Width - this.gridDataBoundGrid1.Model.ColWidths[0];
e.Size = (int)(clientwidth / (float)this.gridDataBoundGrid1.Model.ColCount);
e.Handled = true;
}
}

private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if(e.Index > this.gridDataBoundGrid1.Model.Cols.HeaderCount)
{
int clientheight = this.gridDataBoundGrid1.ClientRectangle.Height - this.gridDataBoundGrid1.Model.RowHeights[0];
e.Size = (int) ( clientheight / (float) this.gridDataBoundGrid1.Model.RowCount );
e.Handled = true;
}
}

Best regards,
Haneef

Rajagopal [Syncfusion]
Replied On July 27, 2007 03:51 AM UTC

Hi Gourav,

Thanks for your interest in Syncfusion Products.

1. To remove the empty space after the last column, you could handle the grid.Model.QueryColWidth event and make the last column in the grid to fill the client area. Below are some code snippets.

bool fillLastCol = true;
void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
int lastColIndex = this.gridControl1.ColCount;
if (this.fillLastCol && e.Index == lastColIndex)
{
int width = this.gridControl1.ColCount <= 0 ? 0 : this.gridControl1.Model.ColWidths.GetTotal(0, lastColIndex - 1);
e.Size = this.gridControl1.ClientRectangle.Width - width;
e.Handled = true;
}
}

Here is a sample that demonstrates this
http://www.syncfusion.com/Support/user/uploads/GC_FillCols_c8ff7b7c.zip

2. By default, GridControl does not support sorting as GridDataBoundGrid and GridGroupingControl does, because sorting is being done through the IBindingList sort support of the datasource of the grid. However, you can follow the approach followed in our GridControlSort sample in the browser samples shipped with the product, which will help you to do sorting for gridcontrol also.

\\Syncfusion\EssentialStudio\5.1\Windows\Grid.Windows\Samples\2.0\FeatureSamples\GridControlSort

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal


Rajagopal [Syncfusion]
Replied On July 27, 2007 03:53 AM UTC

Hi Gourav,

Thanks for your interest in Syncfusion Products.

1. To remove the empty space after the last column, you could handle the grid.Model.QueryColWidth event and make the last column in the grid to fill the client area. Below are some code snippets.

bool fillLastCol = true;
void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
int lastColIndex = this.gridControl1.ColCount;
if (this.fillLastCol && e.Index == lastColIndex)
{
int width = this.gridControl1.ColCount <= 0 ? 0 : this.gridControl1.Model.ColWidths.GetTotal(0, lastColIndex - 1);
e.Size = this.gridControl1.ClientRectangle.Width - width;
e.Handled = true;
}
}

Here is a sample that demonstrates this
http://www.syncfusion.com/Support/user/uploads/GC_FillCols_c8ff7b7c.zip

2. By default, GridControl does not support sorting as GridDataBoundGrid and GridGroupingControl does, because sorting is being done through the IBindingList sort support of the datasource of the grid. However, you can follow the approach followed in our GridControlSort sample in the browser samples shipped with the product, which will help you to do sorting for gridcontrol also.

\\Syncfusion\EssentialStudio\5.1\Windows\Grid.Windows\Samples\2.0\FeatureSamples\GridControlSort

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal


Gourav Nayyar
Replied On July 27, 2007 05:34 AM UTC

Hi Rajagopal
1)thaks for your solution it works . but still a problem is that i want horizontal scrool bar that is not coming after applying this code means if i increase the size of column then the size of last column decreases , that is not our requirement.
Means if user want to increase the size of grid then there comes scroll bar automatically (Horizontal) , but in our case it reduce the last column size.
2) give me one more favour that pl'z send me the sample code of GridControl sort b'cas i am unable to get that in my samples , it's not there in my sample b'cas i'm using Ver. 4.5

Thanks in Advance
Gourav

>Hi Gourav,

Thanks for your interest in Syncfusion Products.

1. To remove the empty space after the last column, you could handle the grid.Model.QueryColWidth event and make the last column in the grid to fill the client area. Below are some code snippets.

bool fillLastCol = true;
void Model_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
int lastColIndex = this.gridControl1.ColCount;
if (this.fillLastCol && e.Index == lastColIndex)
{
int width = this.gridControl1.ColCount <= 0 ? 0 : this.gridControl1.Model.ColWidths.GetTotal(0, lastColIndex - 1);
e.Size = this.gridControl1.ClientRectangle.Width - width;
e.Handled = true;
}
}

Here is a sample that demonstrates this
http://www.syncfusion.com/Support/user/uploads/GC_FillCols_c8ff7b7c.zip

2. By default, GridControl does not support sorting as GridDataBoundGrid and GridGroupingControl does, because sorting is being done through the IBindingList sort support of the datasource of the grid. However, you can follow the approach followed in our GridControlSort sample in the browser samples shipped with the product, which will help you to do sorting for gridcontrol also.

\\Syncfusion\EssentialStudio\5.1\Windows\Grid.Windows\Samples\2.0\FeatureSamples\GridControlSort

Let me know if you have any other questions.

Have a nice time.
Regards,
Rajagopal



Rajagopal [Syncfusion]
Replied On July 27, 2007 10:40 PM UTC

Hi Gourav,

Thanks for your patience.

1. Please try setting the width of the gridcontrol programatically using the code below, to avoid the empty space at the end.

gridControl1.Width = gridControl1.ColWidths.GetTotal(0, gridControl1.ColCount)+5;

2. You can find the GridControlSort sample from the below path for version 4.x
C:\Program Files\Syncfusion\Essential Studio\4.x\Windows\Grid.Windows\Samples\Quick Start\GridControlSort

Let me know if you have any further questions.

Regards,
Rajagopal

Gourav Nayyar
Replied On August 1, 2007 06:08 AM UTC

Hi
Thanks for solution but it does'nt solve my problem because still extra space is coming, if i'll use your previous code then it solve the problem , but when i increase the size of any column tehn it reduces the size of last column, but in that case horizontal scroll bar will come if we increase the size. pl'z suggest me appropriat solution .

Thanks
Gourav

>Hi Gourav,

Thanks for your patience.

1. Please try setting the width of the gridcontrol programatically using the code below, to avoid the empty space at the end.

gridControl1.Width = gridControl1.ColWidths.GetTotal(0, gridControl1.ColCount)+5;

2. You can find the GridControlSort sample from the below path for version 4.x
C:\Program Files\Syncfusion\Essential Studio\4.x\Windows\Grid.Windows\Samples\Quick Start\GridControlSort

Let me know if you have any further questions.

Regards,
Rajagopal

haneefm [Syncfusion]
Replied On August 1, 2007 11:00 PM UTC

Hi Gourav,

Here is a minimal sample that shows this task. Please refer this and let me know if this helps.
ModifiedGC_FillCols.zip

Best regards,
Haneef

Gourav Nayyar
Replied On August 2, 2007 11:04 AM UTC

Thanks for your solution , but when i increase the size of first column in runtime then extra space comes and after that if i have increase the size of any other column then extra space increases. i want to control that extra space. pl'z check by running the code.

Thanks in Advance
Gourav

>Hi Gourav,

Here is a minimal sample that shows this task. Please refer this and let me know if this helps.
ModifiedGC_FillCols.zip

Best regards,
Haneef

Gourav Nayyar
Replied On August 7, 2007 05:17 AM UTC

Hi Haneef
Why ur not giving reply to my post, i'm waiting from the last week . Tell me wether it is possible or not.If it is not possible, in that case it means it is a bug in Syncfusion GriddataBound grid control.
Pl'z give me reply as sson as possible

Thanks
Gourav

>Thanks for your solution , but when i increase the size of first column in runtime then extra space comes and after that if i have increase the size of any other column then extra space increases. i want to control that extra space. pl'z check by running the code.

Thanks in Advance
Gourav

>Hi Gourav,

Here is a minimal sample that shows this task. Please refer this and let me know if this helps.
ModifiedGC_FillCols.zip

Best regards,
Haneef

Gourav Nayyar
Replied On August 27, 2007 08:12 AM UTC

hi Haneef
sorry but it is height. you are not responding to my query from the last 20 days. pl'z tell me wether it is possible or not.

Gourav

>Hi Haneef
Why ur not giving reply to my post, i'm waiting from the last week . Tell me wether it is possible or not.If it is not possible, in that case it means it is a bug in Syncfusion GriddataBound grid control.
Pl'z give me reply as sson as possible

Thanks
Gourav

>Thanks for your solution , but when i increase the size of first column in runtime then extra space comes and after that if i have increase the size of any other column then extra space increases. i want to control that extra space. pl'z check by running the code.

Thanks in Advance
Gourav

>Hi Gourav,

Here is a minimal sample that shows this task. Please refer this and let me know if this helps.
ModifiedGC_FillCols.zip

Best regards,
Haneef

haneefm [Syncfusion]
Replied On August 28, 2007 12:23 AM UTC

Hi Gourav,

My sincere apologies for this delay in responding.

Currently, there is no built-in support for this and also we don't have a sample for matching your requirment with grid.

Also please do let me know if you have any other technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
Haneef

Gourav Nayyar
Replied On September 5, 2007 06:10 AM UTC

Hi Haneef
Thanks for responding to my query. Ok i'll manage with that, but in future if you able to get the solution of this problem . pl'z let me know.

>Hi Gourav,

My sincere apologies for this delay in responding.

Currently, there is no built-in support for this and also we don't have a sample for matching your requirment with grid.

Also please do let me know if you have any other technical questions or I can be of any other assistance. I will be glad to assist you.

Best regards,
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

;