472,093 Members | 2,520 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,093 software developers and data experts.

Change Background Color

Hello,

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

Thanks,
Miguel

Oct 19 '06 #1
2 7413
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" <md*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,

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

Thanks,
Miguel

Oct 19 '06 #2
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" <md*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,

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

Thanks,
Miguel
Oct 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by carramba | last post: by
3 posts views Thread by Mike Barnard | last post: by
2 posts views Thread by chris_culley | last post: by
1 post views Thread by roN | last post: by
4 posts views Thread by martin1 | last post: by
4 posts views Thread by html | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.