[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

changing row color of datagrid on mouseover

Posted on 2005-04-07
1
Medium Priority
?
337 Views
Last Modified: 2012-08-14
Hello experts i have tried changing the row color of a datagrid on mouseover and mouse out and so far i can only get the text within the datagrid row to change, what am i doing wrong?

Here is how i get the text to change color.

 Private Sub dgpreview_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgpreview.ItemDataBound
        'handles the datagrid load
   
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            e.Item.Attributes.Add("onmouseover", "this.style.color='gold';")
            e.Item.Attributes.Add("onmouseout", "this.style.color='red';")
        End If


    End Sub

I tried doing this to get the back ground color of the row to change but it doesnt work.
 Private Sub dgpreview_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgpreview.ItemDataBound
        'handles the datagrid load
 
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            e.Item.Attributes.Add("onmouseover", "this.bgcolor='gold';")
            e.Item.Attributes.Add("onmouseout", "this.bgcolor='red';")
        End If


    End Sub
0
Comment
Question by:tentavarious
1 Comment
 

Accepted Solution

by:
tewonder earned 500 total points
ID: 13734958
Hi!

bgcolor is html. What you're looking for is backgroundColor

For example:
this.style.backgroundColor='#ff0000'

That should to the trick.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question