Link to home
Start Free TrialLog in
Avatar of nuritat
nuritatFlag for Israel

asked on

GridView sort only to specified fields

Hi,

When I turn allow sorting to true, I get sort to all fields,
how can I make the sort option onlt to some fields and to others not?
Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

By setting the DataGridViewColumn.SortMode property you can disable the ability for the user to sort on the given column. You can use Visual Studio to set this property by right-clicking on the DataGridView and choosing the Edit Columns option. Next select the column that you want to disable sorting for and set the SortMode property to NotSortable.

Avatar of nuritat

ASKER

Thats what I was looking for, but unfortunatly I have only "SortExpression" element in property list and not sortMode

Above link contains solution for datagridview  
  dgvCol.SortMode = DataGridViewColumnSortMode.NotSortable

Change it accordingly for Gridview.

ASKER CERTIFIED SOLUTION
Avatar of chandrasekar1
chandrasekar1
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nuritat

ASKER

perfect solution for gridview that doesn't have SortModa as property

thanks!!