Change Background Color

Discussion in 'ASP .Net' started by shapper, Oct 19, 2006.

  1. shapper

    shapper Guest

    Hello,

    How can I change the background color of an Asp:panel when the mouse is
    over it?

    Thanks,
    Miguel
    shapper, Oct 19, 2006
    #1
    1. Advertising

  2. shapper

    Siva M Guest

    In the Page Load event, have:

    MyPanel.Attributes.Add ("onmouseover", "this.style.backgroundColor='red';");
    // Mouse over color
    MyPanel.Attributes.Add ("onmouseout",
    "this.style.backgroundColor='white';"); // Restore default b/g color


    "shapper" <> wrote in message
    news:...
    Hello,

    How can I change the background color of an Asp:panel when the mouse is
    over it?

    Thanks,
    Miguel
    Siva M, Oct 19, 2006
    #2
    1. Advertising

  3. hi

    you have to write the following code on ItemCreated Event of Reapeater
    control.

    Private Sub Repeater1_ItemCreated(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
    Repeater1.ItemCreated
    Dim rtpItem As ListItemType
    Dim pnl As HtmlGenericControl
    rtpItem = ListItemType.Item
    If rtpItem = ListItemType.AlternatingItem Or rtpItem =
    ListItemType.Item Then
    pnl = CType(e.Item.FindControl("pnl"), HtmlGenericControl)
    btn = CType(e.Item.FindControl("btn"), Button)
    pnl.Attributes.Add("onmouseover",
    "javascript:this.style.backgroundColor='red';")
    pnl.Attributes.Add("onmouseoutr",
    "javascript:this.style.backgroundColor='white';")
    End If
    End Sub

    MyPanel.Attributes.Add ("onmouseover",
    "this.style.backgroundColor='red';");
    // Mouse over color
    MyPanel.Attributes.Add ("onmouseout",
    "this.style.backgroundColor='white';"); // Restore default b/g color


    Siva M wrote:
    > In the Page Load event, have:
    >
    > MyPanel.Attributes.Add ("onmouseover", "this.style.backgroundColor='red';");
    > // Mouse over color
    > MyPanel.Attributes.Add ("onmouseout",
    > "this.style.backgroundColor='white';"); // Restore default b/g color
    >
    >
    > "shapper" <> wrote in message
    > news:...
    > Hello,
    >
    > How can I change the background color of an Asp:panel when the mouse is
    > over it?
    >
    > Thanks,
    > Miguel
    Mahesh K. Anajni, Oct 19, 2006
    #3
    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. Ather Ali Shaikh

    How do i change background color to transparent

    Ather Ali Shaikh, Dec 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    4,310
    Chris Jackson
    Dec 4, 2003
  2. Craig Duffy

    Can't change textbox background color

    Craig Duffy, Aug 17, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,052
    Seanray
    Sep 10, 2004
  3. fig000
    Replies:
    0
    Views:
    4,533
    fig000
    Sep 6, 2004
  4. Kamaljeet Saini
    Replies:
    0
    Views:
    389
    Kamaljeet Saini
    Feb 13, 2009
  5. Replies:
    1
    Views:
    258
    marss
    Feb 14, 2007
Loading...

Share This Page