Change background image of asp:button

Discussion in 'ASP .Net' started by Israel Richner, Jan 8, 2007.

  1. I know I can use <a></a> and modify it's :hover and :visited appearance
    in my .css file. I'd like to know if I can do the same for a asp:button
    control.

    I'd like to do some processing of data in the on click event for the
    asp:button control and I would like to be able to control it's
    "visited" and "hover" appearance.

    Using a hyperlink I would just write this in the .css file

    a:hover
    {
    blah blah;}

    a:visited
    {
    blah blah;}

    Can I do the same for an asp:button? If so how?

    I've tried using the asp:hyperlink but it does not have an on click
    event in the code behind page.

    I'm somewhat new to web programming so if there is a better approach to
    this issue please let me know.

    Thanks,
    Iz
    Israel Richner, Jan 8, 2007
    #1
    1. Advertising

  2. Israel Richner

    Mark Rae Guest

    Mark Rae, Jan 8, 2007
    #2
    1. Advertising

  3. Thanks Mark that looks like the control I'm looking for.

    Will I still use

    a:hover
    {
    background-image: url("somepath");}

    ....in order to change the background image when the user hovers over
    the link?

    Iz

    Mark Rae wrote:
    > "Israel Richner" <> wrote in message
    > news:...
    >
    > > Can I do the same for an asp:button? If so how?
    > >
    > > I've tried using the asp:hyperlink but it does not have an on click
    > > event in the code behind page.

    >
    > Sounds like you need a combination of a button and a hyperlink - luckily,
    > Microsoft have provided one for you:
    > http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.linkbutton.aspx
    Israel Richner, Jan 8, 2007
    #3
  4. Israel Richner

    Mark Rae Guest

    "Israel Richner" <> wrote in message
    news:...

    > Will I still use
    >
    > a:hover
    > {
    > background-image: url("somepath");}
    >
    > ...in order to change the background image when the user hovers over
    > the link?


    Well, have you tried it...? ;-)
    Mark Rae, Jan 8, 2007
    #4
  5. I guess I should have before I asked.....it works great!

    Thanks Mark,
    Iz

    Mark Rae wrote:
    > "Israel Richner" <> wrote in message
    > news:...
    >
    > > Will I still use
    > >
    > > a:hover
    > > {
    > > background-image: url("somepath");}
    > >
    > > ...in order to change the background image when the user hovers over
    > > the link?

    >
    > Well, have you tried it...? ;-)
    Israel Richner, Jan 8, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Johansen

    How to change background image ??

    Thomas Johansen, Feb 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    9,329
  2. jc
    Replies:
    3
    Views:
    1,716
  3. jc
    Replies:
    1
    Views:
    1,355
    Neredbojias
    Mar 19, 2008
  4. haiwen

    change button's background?

    haiwen, Jul 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    8
    Views:
    139
    Yan-Hong Huang[MSFT]
    Aug 7, 2003
  5. Dj Frenzy
    Replies:
    3
    Views:
    297
    Robert
    Feb 10, 2004
Loading...

Share This Page