Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Sortable DataGrid in WebPart

  Asked By: Franklin    Date: Aug 23    Category: Sharepoint    Views: 1404

I am trying to create a Web Part that will show information in a DataGrid, but I want to be able to sort and page the data. I've programmatically added a DataGrid to the Control, populated it, and set "AllowSort = True". I've created an event handler for the Sort and wired it up. However, when the DataGrid renders, it does not render the header text as links with a postback. I've tried setting the AllowSort property in different areas of my code including the CreateChildControls and RenderWebPart methods, but it does not seem to make a difference. Is there any way to get this to work in a WebPart?

I've also tried inheriting or adding a DataViewWebPart to my custom WebPart to give me all the paging/sorting/filter capabilities, but could not figure out how to programmatically work with this WebPart. I can add it to the control, but can't populate it with any data. Has anyone successfully done this?

btw.. the reason I'm not just directly using the DVWP is because the system needs to use SSO to pass credentials through a 3rd party dll (in the GAC) to connect to the other datasource. And I'll be using this control on multiple pages.



1 Answer Found

Answer #1    Answered By: Orlando Silva     Answered On: Aug 23

I'm not sure that I fully understand the problem and I don't have the
bandwidth to recreate it. However, it is my experience that postback
events don't work  properly if controls aren't created  in
CreateChildControls and then added  to this.Controls collection.

Didn't find what you were looking for? Find more on Sortable DataGrid in WebPart Or get search suggestion and latest updates.