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

[Solved] Toggle Expand and Collapse of an Item

1 Answer 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kencox
Top achievements
Rank 1
kencox asked on 12 Feb 2010, 01:00 AM
I generate the following client-side code to trigger the built-in expand functionality for the current item:

There are 2 <href='#' onclick='$find("ctl00_ContentPlaceHolder1_RadGrid1_ctl00").expandItem(0);return false;'>comments</a> on this post. 

This expands just fine. However, I'd like to toggle the visibility of the row. I see a ._toggleExpand(this, event) method in the built-in Radgrid code:

<td class="rgExpandCol"><input type="button" name="ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$ctl00" value=" " onclick="$find(&quot;ctl00_ContentPlaceHolder1_RadGrid1_ctl00&quot;)._toggleExpand(this, event); return false;__doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$ctl00','')" title="Expand" class="rgExpand" /></td><td> 
 

Is there a way to harness ._toggleExpand(this, event) to toggle the item?

Or, is there a way that I can detect the state of the row to determine whether to use expandItem() or collapseItem()?

Thanks,

Ken

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Feb 2010, 11:09 AM
Hi,

Please take a look at the code snippet in the help link below where a solution has been provided to create a custom ExpandCollapse button with a client script attached to it to toggle between expand and collapse state .

Hope this helps .


Thanks,
Princy
Tags
Grid
Asked by
kencox
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or