locked
Link button colour change RRS feed

  • Question

  • User304499724 posted

    how to change colour when i click link button 

    Monday, March 25, 2013 1:57 AM

Answers

  • User-1716253493 posted
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            LinkButton lb = (LinkButton)sender;
            lb.ForeColor = System.Drawing.Color.Green;
        }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 25, 2013 2:21 AM

All replies

  • User-42918493 posted

    Just add ForeColor="Green"

    <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Green">LinkButton</asp:LinkButton>

    Monday, March 25, 2013 2:02 AM
  • User112053641 posted

    <style>

    .lnk

    {

    color:#00000;

    }

    .lnk:hover

    {

    color:#FF0000;

    }

    </style>

    <asp:LinkButton ID="linkbutton1" runat="server" CssClass="lnk"/>

    Monday, March 25, 2013 2:09 AM
  • User-1716253493 posted
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            LinkButton lb = (LinkButton)sender;
            lb.ForeColor = System.Drawing.Color.Green;
        }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 25, 2013 2:21 AM
  • User-987211141 posted

    Add script on your page

    function changeColor(){
       document.getElementById("<%=LinkButton1.ClientID%>").style.background='#000000';   
    }
    <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Green" onClientClick="changeColor();">LinkButton</asp:LinkButton>




    Monday, March 25, 2013 2:45 AM
  • User304499724 posted

    working gud, i have list of linkbutton when i click another button i want to change first click linkbutton pervious colour .

    Monday, March 25, 2013 3:19 AM
  • User-987211141 posted

    working gud, i have list of linkbutton when i click another button i want to change first click linkbutton pervious colour .

    If you have use jquery this link is useful to you

    http://www.craiglotter.co.za/2010/01/26/highlight-a-table-row-using-jquery/

    http://www.wittysparks.com/2010/04/29/simple-jquery-zebra-stripe-table-with-row-hover-and-highlight-class/

    Monday, March 25, 2013 3:42 AM