locked
Easy Tabstrip menu - the selected item RRS feed

  • Question

  • User-1581878134 posted

    in the master page

    protected void Page_Load(object sender, EventArgs e)

    {

    //looking for the page - name in the Contentplaceholder1
    string
    s1 =ContentPlaceHolder1.Page.TemplateControl.AppRelativeVirtualPath.ToString();

    for (int i=0; i<Menu1.Items.Count;i++)

    {

    //here the easy way
    if
    (Menu1.Items[ i ].NavigateUrl.ToString() == s1) Menu1.Items[ i ].Selected = true
    ;

    }

    }


    the Master Page

    <form id="form1" runat="server">

    <div>

    <asp:Menu ID="Menu1" runat="server" BackColor="#FFFBD6" DynamicHorizontalOffset="2"

    Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" Orientation="Horizontal"

    StaticSubMenuIndent="10px">

    <StaticSelectedStyle BackColor="#FFCC66" />

    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

    <DynamicHoverStyle BackColor="#990000" Font-Bold="False" ForeColor="White" />

    <DynamicMenuStyle BackColor="#FFFBD6" />

    <DynamicSelectedStyle BackColor="#FFCC66" />

    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

    <StaticHoverStyle BackColor="#990000" Font-Bold="False" ForeColor="White" />

    <Items>

    <asp:MenuItem NavigateUrl="~/Default.aspx" Selected="True" Text="Home" Value="Home">

    </asp:MenuItem>

    <asp:MenuItem NavigateUrl="~/Default2.aspx" Text="Seite 2" Value="Seite 2"></asp:MenuItem>

    <asp:MenuItem NavigateUrl="~/Default3.aspx" Text="Seite 3" Value="Seite 3"></asp:MenuItem>

    <asp:MenuItem NavigateUrl="~/Test/Default.aspx" Text="Seite 4" Value="Seite 4"></asp:MenuItem>

    </Items>

    <StaticItemTemplate>

    <%# Eval("Text") %>

    </StaticItemTemplate>

    </asp:Menu>

    <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">

    </asp:contentplaceholder>

    </div>

    </form>

    Friday, September 23, 2005 9:37 AM

All replies

  • User-1495554297 posted
    hey thank you....

    I just looked for :-D
    Saturday, October 1, 2005 4:59 PM