Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For Expand and Collapse of the Child GridViews I have made use of jQuery.

$("[src*=plus]").live("click", function () { $(this).closest("tr").after("" + $(this).next().html() + "") $(this).attr("src", "images/minus.png"); }); $("[src*=minus]").live("click", function () { $(this).attr("src", "images/plus.png"); $(this).closest("tr").next().remove(); });

I have a button in child grid view to add a new row. After adding it, it will collapse. I want to expand it after adding new row.. only need to collapse while clicking on collapse button. Adding rows in server side.

I want after the postback to keep it expanded .

please help me..

Thanks in advance..

vineetha..
Posted

1 solution

Basically, you need to develop some data class which carries the expanded status of each item. It should be serializeable. Then you can pass it through a view state variable. See, for example:
http://asp.net-tutorials.com/state/viewstate[^],
http://msdn.microsoft.com/en-us/library/7ay27kt9%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.runtime.serialization%28v=vs.110%29.aspx[^].

You need to make it possible to store the whole set of expanded states of all your grid view with all its nested controls, into such a view state object, where it will be serialized. When you read this object from the view state variable, it will be deserialized, and then you will need to restore the state of the grid view.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900