Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Datagrid onmouseover color change

Posted on 2004-10-27
3
Medium Priority
?
298 Views
Last Modified: 2012-06-27
Hi...I am working on a webpage using VB.net...i am using a data grid which displays data from SQL table. I am using <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> for different colors for alternate rows. Now I want to change the color of the row the mouse is over to some other color say Silver. I am doing this with the following code.
                If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
                    If Not IsNothing(e.Item.DataItem) Then
                        e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#DDEEFF'")
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'")
                    End If
                End If
The problem is once the mouse leaves the row i am not able to get the previous color of the row. Can someone help me how to get the original color back. Thank You.
0
Comment
Question by:niki_kiran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
tusharashah earned 1000 total points
ID: 12426032
If you're using different color for Alternating Item then you need to Split your function like following

                If e.Item.ItemType = ListItemType.Item Then
                        e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#DDEEFF'")
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='white'")      'Normal Item Color
                End If
                If e.Item.ItemType = ListItemType.AlternatingItem Then
                        e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#DDEEFF'")
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Gainsboro'") 'Alternating Item Color
                End If

-tushar
0
 

Author Comment

by:niki_kiran
ID: 12426083
thanq
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12426091
You are welcome :)

-tushar
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

610 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