开发者

Change and retain DIV Selected tag in Master Page

I have a CSS class 开发者_Go百科called selected which highlights the DIV as the current step. When they're all in separate pages, I just had to move the selected word to the next DIV.

But how can I achieve the same in Master Page VB .Net? It seems to be one page for all. When the next page loads, how do I get it to highlight the next step? Thank you.

<div id="Div1">
    <div class="step selected" id="Div2">
        <h2>
            Join</h2>
        <img src="./assets/images/signup_arrow.png" class="selected">
    </div>
    <div class="step" id="Div3">
        <h2>
            Choose</h2>
    </div>
    <div class="step" id="Div4">
        <h2>
            INVITE</h2>
    </div>
</div>


If you want to change the value of these controls programatically, you have to make them available server-side via the runat="server" attribute. Once you do that you can get a handle to the controls, either directly in the MasterPage or indirectly on constituent Controls or the Page itself via FindControl("Div2"), which will return an HtmlGeneric control that represents the div. With that you can then use it's Attributes collection to change the class (controls under System.Web.UI.HtmlControls.* lack the direct CssClass property that WebControls have).

There are client-side options as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜