Change Background Color

S

shapper

Hello,

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

Thanks,
Miguel
 
S

Siva M

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


Hello,

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

Thanks,
Miguel
 
M

Mahesh K. Anajni

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top