I am using a splitter control in my page where I have a sidebar that I want to show or hide programatically. My design requires the
collapse and
expand operations to be performed from different buttons.
The only way I have managed to pull this off is by using server-side code and wrapping the
Splitter within a
CallbackPanel, any my code Turns on/off the
Collapsed property of the splitter-pane. This does the trick but I would preferr to do this using javascript, it should be the same code as the demo for
Expand and
Collapse buttons.
How can I do this with JavaScript?
Here's the server-side code I have now:
Code: C#
/// <summary>
/// Handles the Click event of the manageThisPageLinkButton control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void OnManageThisPageLinkButtonClick(object sender, EventArgs e)
{
if (null != this.powerStripSplitterPane)
{
// Expand the Power Strip Splitter Pane
this.powerStripSplitterPane.Collapsed = false;
}
}
/// <summary>
/// Handles the Click event of the closePowerStripImageButton control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
protected void OnClosePowerStripImageButtonClick(object sender, System.Web.UI.ImageClickEventArgs e)
{
if (null != this.powerStripSplitterPane)
{
// Collapse the Power Strip Splitter Pane
this.powerStripSplitterPane.Collapsed = true;
}
}