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.

How to sort GridGroupingControl from code behind?

Thread ID:

Created:

Updated:

Platform:

Replies:

54712 Jan 16,2007 02:50 AM Feb 2,2007 01:52 AM Windows Forms 10
loading
Tags: Grouping
Dhiraj
Asked On January 16, 2007 02:50 AM

Hi,
Please tell me how to sort the grid grouing control from code behind since the grid get populated at runtime hence there is need to sort the control at runtime.

Please guide me. Please tell me fast what have to do?


Warm Regards,
Dhiraj Karmalkar

Administrator [Syncfusion]
Replied On January 16, 2007 11:09 AM

Hi Dhiraj,

Thank you for being patience.

You can sort the GridGroupingControl columns programmatically by using the following code snippet.
>>>>>>>>>>>>>Code Snippet<<<<<<<<<<<
this.gridGroupingControl1.TableDescriptor.SortedColumns.Add("Column2");
>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<

Please refer to our shipped browser samples [ \\windows\Grid.Grouping.Windows\Samples\Sorting ] for more details.

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Administrator [Syncfusion]
Replied On January 16, 2007 11:19 AM

Hi Dhiraj,

Please refer to the following sample which demonstrates the sorting of the column, the data’s are being loaded at runtime.

Sample : GGC_SortingColumns.zip

Best regards,
Madhan

Administrator [Syncfusion]
Replied On January 21, 2007 03:30 AM


Hi Madhan,

Thanks for sample code but I am using grid in the asp.net. One more thing is that whenever I assign DataSource from DataTable it take all the columns from the datatable that I don't want so I set them false and again I am setting it's properties so from here I can not able to see the tringle icon for sorting. Is there any way to make it visible?

please guide me.

Thanks and Regards,
Dhiraj Karmalkar



>Hi Dhiraj,

Please refer to the following sample which demonstrates the sorting of the column, the data’s are being loaded at runtime.

Sample : GGC_SortingColumns.zip

Best regards,
Madhan

Gokul B [Syncfusion]
Replied On January 22, 2007 01:33 PM

Hi Dhiraj,

I apologize for the delay in responding.

You can remove a particular column programmatically by using the following code snippet.

this.GridGroupingcontrol1.TableDescriptor.VisibleColumns.Remove("ColumnName");

However,Please have a look at our attached sample which illustrates the Column Removing and sorting of the particular column.

Forum_54712.zip

Please try this and Let us know if you need any other queries.

Regards,
Gokulkumar.B




Dhiraj
Replied On January 23, 2007 02:03 AM

Hi Gokulkumar,

Thanks for code sample. Here I have attached the sample for my application where I am taking values from database and when I assign datatable to grid it takes all the Columns from the datatable that what I don't want. So I removed one column but trouble I am getting is that I don't want header names as that of those are coming from the database I want these to be different one that is I want to set them manually from code behind.

Which is not working! Tell me any method by which this can be achieved?


Thanks and Regards,
Dhiraj K




>Hi Dhiraj,

I apologize for the delay in responding.

You can remove a particular column programmatically by using the following code snippet.

this.GridGroupingcontrol1.TableDescriptor.VisibleColumns.Remove("ColumnName");

However,Please have a look at our attached sample which illustrates the Column Removing and sorting of the particular column.

Forum_54712.zip

Please try this and Let us know if you need any other queries.

Regards,
Gokulkumar.B





GridTest20.zip

Gokul B [Syncfusion]
Replied On January 23, 2007 11:02 AM

Hi Dhiraj,

Please refer to our below code snippet to change the name of the column to be displayed in the column header.

'Gets the ColumnDescriptor for the specified Column
Dim grid1 As GridColumnDescriptor = GridGroupingControl1.TableDescriptor.Columns.GetColumnDescriptor("CustomerName")
'Changes the name of the column to be displayed in the Column header.
grid1.HeaderText = "Name"

Let us know if you need any other help.

Regards,
Gokulkumar.B

Dhiraj
Replied On January 23, 2007 10:44 PM

Hi Gokulkumar,

Thanks for help it's reallly helpfull but one I can not able to get the sort icon after doing this.

But rest of things are working fine. Well thanks for the help. It was really great.

Thanks and Regards,
Dhiraj Karmalkar




>Hi Dhiraj,

Please refer to our below code snippet to change the name of the column to be displayed in the column header.

'Gets the ColumnDescriptor for the specified Column
Dim grid1 As GridColumnDescriptor = GridGroupingControl1.TableDescriptor.Columns.GetColumnDescriptor("CustomerName")
'Changes the name of the column to be displayed in the Column header.
grid1.HeaderText = "Name"

Let us know if you need any other help.

Regards,
Gokulkumar.B

Dhiraj
Replied On January 24, 2007 05:12 AM

Hi Gokulkumar,

I have one more doubt about is that if initially I have nothing to show in the grid then on some server event, I am displaying the grid columns but what happening is that I can not able to see the grid columns and it gives error or it gives same error that earlier I got. So I explicitely added the grid columns but then I can not able to see the grid sort icon.

Please guide me.

Thanks and Regards,
Dhiraj K






>Hi Gokulkumar,

Thanks for help it's reallly helpfull but one I can not able to get the sort icon after doing this.

But rest of things are working fine. Well thanks for the help. It was really great.

Thanks and Regards,
Dhiraj Karmalkar




>Hi Dhiraj,

Please refer to our below code snippet to change the name of the column to be displayed in the column header.

'Gets the ColumnDescriptor for the specified Column
Dim grid1 As GridColumnDescriptor = GridGroupingControl1.TableDescriptor.Columns.GetColumnDescriptor("CustomerName")
'Changes the name of the column to be displayed in the Column header.
grid1.HeaderText = "Name"

Let us know if you need any other help.

Regards,
Gokulkumar.B

Administrator [Syncfusion]
Replied On January 25, 2007 04:07 AM

Hi Dhiraj,

Below specified code helps you to get the 'Sort' icon on the renamed Column Header

grid1.TableDescriptor.SortedColumns.Add("CustomerName",ListSortDirection.Ascending)

Please let us know if you need any further assistance.

Regards,
Valli.

Dhiraj
Replied On February 2, 2007 01:52 AM

hi Valli,

Thanks for the suggestion but that didn't worked for me but I solved it whith different approach.

Thanks

Warm Regards,
Dhiraj Karmalkar

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.

;