all groups > asp.net datagrid control > november 2005 >
You're in the

asp.net datagrid control

group:

Mouseover, mouseout, click etc on datagrid.


Re: Mouseover, mouseout, click etc on datagrid. S.M. Altaf [MVP]
11/25/2005 12:00:00 AM
asp.net datagrid control: 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","myColoringFunction();")

HTH
Altaf


--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com


[quoted text, click to view]

Mouseover, mouseout, click etc on datagrid. johnnydublin NO[at]SPAM gmail.com
11/25/2005 2:50:55 AM
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
AddThis Social Bookmark Button