using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Telerik.WebControls;

namespace DockableObject
{
  public partial class _Default : System.Web.UI.Page
  {

    private string DockingState
    {
      get
      {
        return ViewState["DockingState"] == null ?
          "" : ViewState["DockingState"].ToString();
      }
      set
      {
        ViewState["DockingState"] = value;
      }
    }

    protected void RadToolbar1_OnClick(object sender,
      RadToolbarClickEventArgs e)
    {
      if (e.Button.CommandName == "Save")
      {
        this.DockingState = RadDockingManager1.SaveState();
      }
      else
      {
        if (this.DockingState.Length > 0)
        {
          RadDockingManager1.LoadState(this.DockingState);
        }
      }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
      rdoBottom.Command += new EventHandler(rdoBottom_Command);
    }

    void rdoBottom_Command(object sender, EventArgs e)
    {
      RadDockableObjectCommandEventArgs args = (RadDockableObjectCommandEventArgs)e;
      if (args.Command.Name == "Save")
      {
        this.DockingState = RadDockingManager1.SaveState();
      }
      else
      {
        if (this.DockingState.Length > 0)
        {
          RadDockingManager1.LoadState(this.DockingState);
        }
      }
    }
  }
}
