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 click on columnheader, and sorting in datagrid ?

Thread ID:





36375 Oct 28,2005 03:23 AM Dec 16,2005 07:59 AM Windows Forms 3
Tags: FAQ
Administrator [Syncfusion]
Asked On October 28, 2005 03:23 AM

Hi. Nice site :) As the topic says. When i click on a colum header, i want to sort the data in the datagrid.. The datagrid is using an arraylist as source.. So question 1: How do I "catch" the click on certain column header question 2: How do I sort the data when clicking on the column header. Thank you,

Anupama Roy [Syncfusion]
Replied On November 2, 2005 02:48 AM

Hi Lasse, Do you have many columns in your ArrayList? You can write code on the DataGrid''s MouseDown event to catch the click on Colum header. And for sorting the data,save your data in arrary list and bind your dataview and set the Sort property of DataView .After that call DataGrid''s Refresh method. If you are populating from a database,you can use the SQL statement Select...from...OrderBy ,but you need to load data from database every time you want to sort the data, which makes application slower. Regards, Anu.

Administrator [Syncfusion]
Replied On December 16, 2005 07:54 AM

Hi How do i know which coloumn is selected in the mousedown event? thanks in advance

Administrator [Syncfusion]
Replied On December 16, 2005 07:59 AM

Hai I think thr is no need of any code.Just keep the AllowSorting=true. Am i right?


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.