473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

OnMouseOver for a DataGrid control

Hi,

I want to create a client-side script
that highlights a row of a datagrid control
when the mouse cursor is over that row (i.e.
chage the color of the row to something else
than the current color), but apparently the
datagrid doesn't have an OnMouseOver event.
It works with regular html tables but not with
the datagrid control. is there a way to do it?

Thanks
Nov 18 '05 #1
5 1667
have you tried

datagrid1.attributes("onmouseover")="myjavafunctio n()"
--
William Main
"Avi Shilon" wrote:
Hi,

I want to create a client-side script
that highlights a row of a datagrid control
when the mouse cursor is over that row (i.e.
chage the color of the row to something else
than the current color), but apparently the
datagrid doesn't have an OnMouseOver event.
It works with regular html tables but not with
the datagrid control. is there a way to do it?

Thanks

Nov 18 '05 #2
Nope :)
I'm totally new to asp.net and
its controls. I didn't even know
that the datagrid had an attributes
property (it is a property, right?)

Thanks for any help you give, guys

"William Main" wrote:
have you tried

datagrid1.attributes("onmouseover")="myjavafunctio n()"
--
William Main
"Avi Shilon" wrote:
Hi,

I want to create a client-side script
that highlights a row of a datagrid control
when the mouse cursor is over that row (i.e.
chage the color of the row to something else
than the current color), but apparently the
datagrid doesn't have an OnMouseOver event.
It works with regular html tables but not with
the datagrid control. is there a way to do it?

Thanks

Nov 18 '05 #3
I still can't figure out how to do that.
Sorry for my ignorance.
Can anyone please help me?

"William Main" wrote:
have you tried

datagrid1.attributes("onmouseover")="myjavafunctio n()"
--
William Main
"Avi Shilon" wrote:
Hi,

I want to create a client-side script
that highlights a row of a datagrid control
when the mouse cursor is over that row (i.e.
chage the color of the row to something else
than the current color), but apparently the
datagrid doesn't have an OnMouseOver event.
It works with regular html tables but not with
the datagrid control. is there a way to do it?

Thanks

Nov 18 '05 #4
You have few steps before you can achieve that:
First, write down a js function that retrieves 2 args: tr & color and change
the tr bgcolor according to the parameters: this is done by iterating over
all it's cells.
Second, write event handler for the ondatagriditemcreated of the datagrid
control you meant to enable this feature. In that event handler add 2
attributes for each datagriditem (not including footer, header etc.). These
2 attributes will be onmouseover and onmouseout. In it write a simple code
that will use the above js function to change the tr color (each
datagriditem is actually a TR).

Nov 18 '05 #5
Private Sub dg_ItemCreated(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg.ItemCreated

If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then

e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor
= 'lightgreen';")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor
= 'white';")

End If

End Sub

HTH,
Greg

"Avi Shilon" <Av*******@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
Nope :)
I'm totally new to asp.net and
its controls. I didn't even know
that the datagrid had an attributes
property (it is a property, right?)

Thanks for any help you give, guys

"William Main" wrote:
have you tried

datagrid1.attributes("onmouseover")="myjavafunctio n()"
--
William Main
"Avi Shilon" wrote:
> Hi,
>
> I want to create a client-side script
> that highlights a row of a datagrid control
> when the mouse cursor is over that row (i.e.
> chage the color of the row to something else
> than the current color), but apparently the
> datagrid doesn't have an OnMouseOver event.
> It works with regular html tables but not with
> the datagrid control. is there a way to do it?
>
> Thanks

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
5
by: Ryan Moore | last post by:
I am trying to modify the onMouseOver attribute of a <td> cell created by a DataList... according to ...
1
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). ...
0
by: steemje | last post by:
Hallo friends, I am wondering how to influence the presentation of induvidual cells in a grid row. At present I have added : "e.Item.Attributes.Add("onmouseover",...
4
by: Rob R. Ainscough | last post by:
I'm using .NET v1.1 with ASPX web page. I'm trying to have a RollOver hyperlink that will change images on an image control and update the text in a Label control. I've got the image swapping...
2
by: Justin Rowe | last post by:
I'm attempting to design a site with alot of dynamic content and intractability, however I've hit a snag when it comes to the function of the onMouseOver and onMouseOut events. Using a bit of code...
1
by: pavan | last post by:
hi, I have a set of 11 images and a datagrid. when i move mouse over the images,the datagrid should get popullated each time with respect to the mouseover image. how to achive this?
1
by: cashdeskmac | last post by:
I am using VS2005 and creating a menu control. I have a script section in the control (and also in the page itself) which will show a certain set of submenus depending on a parameter passed in to...
3
by: =?Utf-8?B?RGVlcGE=?= | last post by:
Hi All, I have a webform in asp.net framework 1.1 where the dropdownlist is populated with list of locations from the database. The depending on the list selected, the user will be able to see...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.