473,396 Members | 2,082 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,396 software developers and data experts.

Mouseover, mouseout, click etc on datagrid.

Hi there,
Does anyone know of a way that I can specify javascript functions that
are to be run when a cell is clicked, mouse over etc in a datagrid
without attaching the function to every single cell?

I have a diary view with resources across the top and times down the X
axis which means it contains hundreds of cells. I want to add some nice
javascipt that makes the cells change colour as the mouse moves over
them etc. I can get it to work fine by putting a function call behind
each cell (added during the itemdatabound event) but it makes for a
very big download and a lot of processing at data itemdatabound time.
Can I specify that if any TD is clicked I want to run a function?
Any help would be much appreciated,
Thanks
Johnny

Nov 25 '05 #1
1 2273
Hi Johnny,

Handle the ItemDataBound event for the datagrid. In each of the rows of type
Item or AlternateItem, look for the cell you want.
Perform an .Attributes.Add() for the cell, and in this method you can
specify the javascript function you want to call. For example (I'm typing
this off my head, I don't have the IDE open)

e.Item(4).Cells(0).Attributes.Add("onMouseOver","m yColoringFunction();")

HTH
Altaf
--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
<jo**********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi there,
Does anyone know of a way that I can specify javascript functions that
are to be run when a cell is clicked, mouse over etc in a datagrid
without attaching the function to every single cell?

I have a diary view with resources across the top and times down the X
axis which means it contains hundreds of cells. I want to add some nice
javascipt that makes the cells change colour as the mouse moves over
them etc. I can get it to work fine by putting a function call behind
each cell (added during the itemdatabound event) but it makes for a
very big download and a lot of processing at data itemdatabound time.
Can I specify that if any TD is clicked I want to run a function?
Any help would be much appreciated,
Thanks
Johnny

Nov 25 '05 #2

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

Similar topics

3
by: Colin Steadman | last post by:
Help! I'm a stupid HTML bod and I dont do Javascript! I have a grey coloured table that displays certain columns in either red, green or orange to give meaning and emphasis to certain data. ...
3
by: John | last post by:
Imagine this: I have a gif-image with text, coloured green. When MouseOver occurs the gif will swap to another gif with red colourded text. On MouseOut the gif turns back to the green text. ...
2
by: Alex | last post by:
On my page I have a lot string like this: <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc1</span> <span onmouseover="callMe(this)" onmouseout="callMe(null)" >abc2</span> <span...
1
by: Michael M | last post by:
Hi I am trying to add mouseover property to asp:datagrid in the asp .net page My pag So the output in HTML for a row should look like <tr style="onmouseover=this.bgcolor=#ff0000;...
2
by: Matt Colegrove | last post by:
How does one set a Mouseover/Mouseout event on a cell in a GridView? I can successfully assign these events to be active on a row in a GridView. I can do this with a DataGrid, by adding code to...
1
by: dheepakk | last post by:
Hi All, When a mouseover event takes place over a link the popup window is displayed. I also have a mouseout on the link.So if the popup window comes up,has a dimension such that the...
1
sgeklor
by: sgeklor | last post by:
Dear All, My question refers to how best to organise my mouse events to correctly and efficiently give the effect I want. On my form I have a panel and that panel contains a number of controls....
2
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the...
2
by: markszlazak | last post by:
Could someone check out the following code and please help me understand the problem and fix it. It seems like some events are not firing when my mouse moves over the table cells to quickly causing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.