ASP.NET Slide Menu Tutorial - SelectedId

Each menu item has a unique ID.

There are two ways to get the selected item ID:
  1. Using postbacks
  2. By setting AutoQueryString = true property and getting the value from Query String

This menu uses postbacks to display the selected item ID:

Currently selected: a_a_pb

Sample code
This menu uses Query String to set the Selected ID value:

Currently selected: a_a_qs

Sample code

Postback - ASP.NET
<osm:SlideMenu
        id = "tutSelID"
        runat = "server"
        SelectedId = "c11" >
    <menuitems>
        <osm:Parent id="p1">Company Home</osm:Parent>
            <osm:Child id="c11" OnClick="menuClick">
                Entertainment
            </osm:Child>
            <osm:Child id="c12" OnClick="menuClick">
                Games
            </osm:Child>
            <osm:Child id="c13" OnClick="menuClick">
                Greeting Cards
            </osm:Child>
            <osm:Child id="c14" OnClick="menuClick">
                Downloads
            </osm:Child>
        <osm:Parent id="p2">System Tasks</osm:Parent>
            <osm:Child id="c21" OnClick="menuClick">
                View system info
            </osm:Child>
            <osm:Child id="c22" OnClick="menuClick">
                Add programs
            </osm:Child>
    </menuitems>
</osm:SlideMenu>

Query String - ASP.NET
<script language="C#" runat="server">
    void Page_Load(object sender, EventArgs e) {
        string osmId = Request.QueryString["sm"];
        if(osmId != null)
            tutSelId.SelectedId = osmId;
    }
</script>

<osm:SlideMenu
        id = "tutSelID"
        runat = "server"
        SelectedId = "c11" >
    <menuitems>
        <osm:Parent id="p1">Company Home</osm:Parent>
            <osm:Child id="c11" Url="tutorial_selectedid.aspx">
                Entertainment
            </osm:Child>
            <osm:Child id="c12" Url="tutorial_selectedid.aspx">
                Games
            </osm:Child>
            <osm:Child id="c13" Url="tutorial_selectedid.aspx">
                Greeting Cards
            </osm:Child>
            <osm:Child id="c14" Url="tutorial_selectedid.aspx">
                Downloads
            </osm:Child>
        <osm:Parent id="p2">System Tasks</osm:Parent>
            <osm:Child id="c21" Url="tutorial_selectedid.aspx">
                View system info
            </osm:Child>
            <osm:Child id="c22" Url="tutorial_selectedid.aspx">
                Add programs
            </osm:Child>
    </menuitems>
</osm:SlideMenu>

"Thank you very much for such a great product. We had purchased three of your competitors editor controls with each of them having functional flaws that made it incompatible with our application. Obout's editor is the only one that meets our requirements. Also, your support has been absolutely the best!"

Darren Terrell
inkubook

Random testimonial   All testimonials