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

[Solved] Retaining Group Expanded/Collapsed State

4 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 20 May 2009, 05:49 PM
Hi all,

We are in the process of converting from the older ASP.NET Telerik grid to the new grid for ASP.NET Ajax and we have run into some difficulties using the GroupExpanded/Collapsed client-side methods.

The old grid used to pass in the row that was expanded/collapsed and we could perform an ajax request to let the server know that about the change in state:

 

function TaskGrid_GroupExpanded(row)

 

{

    window[

"StartAjax"].AjaxRequest(row.Control.innerText);

 

}

The new code that we have created looks like this:
function TasksPortal_GroupExpanded(sender, eventArgs)

 

{

 

    SessionWS.Set(

"TaskPortalExpandGroups", 'TaskPortalExpand~' + sender.Control.innerText);

 

 

 

    return false;

 

}

According to the help documentation, the sender object should be the datarow.  The problem is that the sender.Control.innerText statement returns the text for the entire grid and not just the current row.

Does anyone have any suggestions on how to accomplish this using the new grid?

Thanks for the help,
Greg

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 May 2009, 07:10 AM
Hi Greg,

Here is a code library submission which explains how to retain the Groups Expanded State on Rebind using server side approach. Go through it and see if it meets your requirement.
Persist Groups Expanded State on Rebind



Shinu.


0
Trevor
Top achievements
Rank 1
answered on 21 May 2009, 01:15 PM
Thanks for that link Shinu, the issue with that example though is that a postback will fire whenever the user expands/collapses the grid correct?  I'd really like to avoid that if I can and make use of the client-side expand/collapse event.
0
Accepted
Tsvetoslav
Telerik team
answered on 25 May 2009, 01:26 PM
Hello Greg Dickie,

Thank you for contacting us and for your question.

Excuse us for having failed to update this piece of documentation, indeed you are correct in observing that the first argument passed to the group expanded event is the client component representing the grid itself. Furthermore, the new ASP.NET AJAX RadGrid control does fire the group expanded/collapsed event but no longer constructs an object representing any data item. Therefore, you need to find the group header row manually.

For your convenience, I have prepared  a small sample that demonstrates how to do that. Please, take a look at it and see if it helps with your implementation.

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
Trevor
Top achievements
Rank 1
answered on 26 May 2009, 05:01 PM
Thanks Tsvetoslav, this worked great.
Tags
Grid
Asked by
Trevor
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Trevor
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or