Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing Sort against DataView in a dataGrid

Status
Not open for further replies.

StevenK

Programmer
Joined
Jan 5, 2001
Messages
1,294
Location
GB
I have a DataView that we display in a dataGrid. When I click in the top columns of the grid I get to sort the data in the rows underneath. This is a very nice feature that I sometimes utilise.
However I have an occasion when I want to prevent the user from Sort'ing in the grid.
I've tried to set the 'AllowSorting' to false but this still allows me to sort the data in the grid.
Can anyone enlighten me as to how I might prevent the sorting in the dataGrid of the DataView ?
Any help would be appreciated.
Thanks in advance.
Steve
 
StevenK,
Not 100% certain here, but is it the AllowSorting property on the grid, or the column that you have set? The gird is a container, the column is the object you are affecting. I would look at properties available on the column.


Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
I've now solved this problem.
The 'AllowSorting' property exists against the dataGrid component itself.
My issue was that I was making use of TabelStyles against the grid (so that not all table columns were seen and only some in the grid were editable). The 'AllowSorting' proprty also exists against the 'dataGrid1.TableStyles[0]' so I was able to prevent sorting at that level.
Thanks for the suggestion though.
I realise it's always nice to see a conclusion on these posts - so figured I'd put up the answer to mine.
Steve
 
Steve,
Well, sometimes it's not about providing the right answer, but pointing someone in the right direction, or at least helping to think about a problem differently. Glad I could help in that regard.

Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top