Monday, June 27, 2005

Sharepoint Datagrid sorting?

Following is an email I received from a reader regarding DataGrid sorting problem in SharePoint

Hello,

I have read several of your articles which have really helped To get me started developing Web Parts for Sharepoint. I was just wondering if you have written or know of any articles dealing specifically with consuming events in a datagrid (sorting) in a web part? I have designed an "Active Directory Contact List" which pulls in users, addresses, and phone numbers directly from Active Directory.

It works very well except I have not been able to get it to sort. Thanks for your help,

Tim Andrews, MCSE, CCA

Hi Tim

I haven't written any articles around this sorting problem. But I believe it is got to do with not firing up the events in the web part.

This mainly happens when you don't write the event handler code in CreateChildControl method. At the same time, put the data population method for your datagrid in the CreateChildControls method too.

Good luck.

Wow, that was it. You da man! Maybe I'll send you a copy of it when it's done, THANKS!

TIM

And he sure did,

I received the code today and going to play around it.

Thanks Tim

2 Comments:

At 8:53 PM, Anonymous Anonymous said...

Hi Gayan,

I have been trying to sort a DataGrid in a SharePoint WebPart and I found that for some reason my DataGridSortCommandEventHandler is not getting fired. Then I saw your Blog. I really could not understand what you meant while saying that we should have the event handler code and the data population method code in the CreateChildControls method. Could you help me out with an explanation and a sample code.

Thanks for your help,

Kodi

 
At 2:50 AM, Blogger Travis said...

I am new to sharepoint and I am having a similiar problem although i didn't write any code. I am basically trying to custom the search results webpart using sharepoint designer. I selected the checkbox that enables sorting for the datagrid. If I hover over over the column headers I can see the postback event for sorting is there but yet when i click the header nothing actually gets sorted. Any suggestions for me?

 

Post a Comment

<< Home