This is a migrated thread and some comments may be shown as answers.

[Solved] RadGrid in MOSS WebPart Fails to Maintain SelectedItems

5 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 03 May 2009, 12:32 AM
I have a RadGrid set up so that the user can select line items in the grid via a checkbox.  The grid is using the ClientSelectColumn to allow for item selection.  There is also a dropdown list on the control that will rebind the grid with different data based on the item selected in the dropdown list.  Basically the user can selected from a list of items in a dropdown list, which should force the grid on that same user control to rebind with a different set of data (same structure - just different values).  The control is set up to use the RadAjaxManager and RadLoadingPanel to provide partial page postbacks of the grid.  It is desired that the user just see the loading panel as the grid data is rebound.

When I put this control in a regular ASP.NET page, it works just great.  All the item selections seem to hold and I can view them server side (the user hits a submit button to submit the selected items in the grid).  However, I now need to use this control from within a MOSS 2007 web part.  When the control is used from the web part, the grid selected items no longer seem to hold.

When the web part first renders, the grid looks good.  I can select items in the grid and the selected line highlights in the grid.  If I then make a selection from the dropdown list and do the partial postback, the grid appears to rebind, but it seems as if something is wrong with the selected items.  If I click on the checkbox to select a row, the row no longer highlights.  When I submit the form, the grid's SelectedItems property is zero - even thought there are selected items in the grid.

This is really starting to confuse me.  It seems to me like the problem has to be related to the ajax postbacks and being inside a web part, but I'm not sure where or how to fix it. 

Any suggestions or advice on this would be greatly appreciated.

5 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 03 May 2009, 12:44 AM
Just to follow up - when I remove the RadAjaxManager, RadLoadingPanel, and RadAjaxPanel from the control, the grid seems to be able to handle the selected items just fine.  So, sure seems like something is going wrong with the ajax portion.

Rebinding the grid based on the user selection from the dropdown list can be a somewhat timely operation (10 sec. sometimes). I'd really like to figure out a why to get the ajax portion working from within the webpart.


Thanks!
0
Tsvetoslav
Telerik team
answered on 07 May 2009, 01:07 PM
Hello Michael,

I tried to reproduce this problem but to no success. Please, make sure that you have followed the guidelines set in the following help article (here) and review the attached sample for comparison.

Do let us know of the result.

Greetings,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Vadim
Top achievements
Rank 1
answered on 10 May 2009, 06:45 PM
Hi, Tsvetoslav

I did all strictly by the book, had no problem with postbacks (they're captured by RadAjaxManager), but every time I need to refresh top level table's data, I got complete recreating of the whole control instead of firing NeedData only (for lower level tables in hierarchy everything works fine - only DetailTableDataBind is fired.)

I thought I'm doing something wrong, but after looking at web part from your attachment I see it doing absolutely the same thing - instead of simply call NeedDataSource it starts from the very beginning every time, recreates the controls and completely loses previous state.

Is there a way to make the web part to do only necessary things and not to recreate everything from scratch when something changes in top level table?

0
Tsvetoslav
Telerik team
answered on 13 May 2009, 07:15 AM
Hi Vadim,

Although the grid is recreated programmatically each time, it preserves its ViewState and there should be no problem for the selected items to be submitted to the server. I tested this scenario and it works find on my end. Please, check the modified sample, try running it and let me know if it helps.

Best Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Vadim
Top achievements
Rank 1
answered on 13 May 2009, 07:20 PM
Tsvetoslav,

thank you for reply. I'll definitely check it.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Tsvetoslav
Telerik team
Vadim
Top achievements
Rank 1
Share this question
or