Loading ...

Highlighting a Linkbutton onclick

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » Highlighting a Linkbutton onclick

Highlighting a Linkbutton onclick

Posts under the topic: Highlighting a Linkbutton onclick

Posted: 12/27/2011

Lurker 25  points  Lurker
  • Joined on: 6/15/2011
  • Posts: 5

How to Highlighting a Linkbutton onclick ? Please help.

Thanks in advance


Posted: 12/28/2011

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424
  Answered

There are many ways. Your first option would be using CSS by setting its style on click or by doing it in the code behind at Click event of the Button by setting its BackgroundColor.

Check this post: http://forums.asp.net/t/1351547.aspx/1


Posted: 12/28/2011

Lurker 25  points  Lurker
  • Joined on: 6/15/2011
  • Posts: 5

Thanks Vincent. I tried your link  http://forums.asp.net/t/1351547.aspx/1  by doing it in the code behind at Click event of the Button.  

The problem is the postback of the linkbutton. Due to postback the button  back to its normal state instead of highlighting. 

how to solve this problem ?



Posted: 12/28/2011

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424

How about doing something like this:

 protected void LinkButton1_Click(object sender, EventArgs e){
            LinkButton1.BackColor = System.Drawing.Color.Red;
 }



Posted: 12/29/2011

Lurker 25  points  Lurker
  • Joined on: 6/15/2011
  • Posts: 5

I tried this way also but its not working. 


Posted: 12/29/2011

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424

It works for me. Can you please post your codes here both ASPX and code behind.


Page 1 of 1 (6 items)