ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

Expand some parent menus only


I have a SlideMenu with three parent menus. How to expand the first two parent menus on page load?
The ALLExpanded property allows to expand all parent menus on page load, but I want the first two ones be expanded only.


Here is the code sample:

<form id="Form1" runat="server">
  <asp:ScriptManager runat="server" ID="scriptManager" />
  <osm:SlideMenu id = "pro_1" KeepExpanded="true"
                           runat = "server" AutoPostback="true"
         <osm:Parent id="parent1">Company Home</osm:Parent>
              <osm:Child>Greeting Cards</osm:Child>
         <osm:Parent id="parent2">System Tasks</osm:Parent>
              <osm:Child>View system info</osm:Child>
              <osm:Child>Add programs</osm:Child>
              <osm:Child>Change settings</osm:Child>
              <osm:Child>Add users</osm:Child>
         <osm:Parent id="parent3">Obout controls</osm:Parent>
              <osm:Child>Slide menu</osm:Child>
              <osm:Child>HTML Editor</osm:Child>
  <script type="text/javascript">
     function pageLoad(sender, args) {
        // The slide menu client side object can be accessed by oboutSM{id} object
        // where {id} indicates the ID of the slide menu
        // expand the first parent
        // expand the second parent with a  little delay - the first expanding must be finished
        setTimeout(function () { oboutSMpro_1.parentClick("parent2"); }, 100);