.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> General >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How to sort columns in Infragistics Wingrid

Posted By:Deepika Haridas       Posted Date: October 27, 2010    Points: 50    Category: General    URL: http://www.dotnetspark.com  

This code shows how WinGrid allows the user to sort on both single and multiple columns by clicking on the column headers.

This code demonstrates how WinGrid allows the user to sort on both single and multiple columns by clicking on the column headers. The UltraWinGrid allows user to sort by setting the .HeaderClickAction property to either .SortSingle or .SortMulti.

Below are the steps to achieve the sameĀ 

1. Adding using/imports directives
Imports Infragistics.Win.UltraWinGrid
using Infragistics.Win.UltraWinGrid;

2. The InitializeLayout event of UltraGrid sets the default HeaderClickAction for all bands and all columns

Private Sub UGSort_InitializeLayout(ByVal sender As Object, _
  ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) _
  Handles UGSort.InitializeLayout
  	e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle
End Sub
private void UGSort_InitializeLayout(object sender, 
  Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
	e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle;

3. The code in the Button Click event instructs the UltraWinGrid to sort on band 1 column 2 in Descending order

Visual Basic:
Private Sub btnSortBand1Column2_Click(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles btnSortBand1Column3.Click
	Me.UltraGrid1.DisplayLayout.Bands(1).Columns(2).SortIndicator = _
End Sub

private void btnSortBand1Column2_Click(object sender, EventArgs e)
	this.ultraGrid1.DisplayLayout.Bands[1].Columns[2].SortIndicator = 
 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend