troubleshooting Question

change an html LI tags id or class property

Avatar of ej1111
ej1111 asked on
ASP.NET
3 Comments1 Solution394 ViewsLast Modified:
I have some code:

<UL>
      <LI class="current" id="li1">
            <asp:LinkButton id="link1" runat="server">link1</asp:LinkButton></LI>
      <LI id="li2">
            <asp:LinkButton id="link2" runat="server">link2</asp:LinkButton>
</LI>
</UL>

What i need to do is change that class=current when someone clicks on one of the links. so for example if a user clicks on Link 2 it would then read:

<UL>
      <LI id="li1">
            <asp:LinkButton id="link1" runat="server">link1</asp:LinkButton></LI>
      <LI  class="current"  id="li2">
            <asp:LinkButton id="link2" runat="server">link2</asp:LinkButton>
</LI>
</UL>

My code behind would be essentially like this for each button(this obviously doesnt work!):

Private Overloads Sub link1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles imgDemo.Click

        li1.CssClass = "current"
        li2.CssClass = "unselected"

    End Sub

any thoughts on how i could make this happen?

thanks!


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros