|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 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 <johnnydub***@gmail.com> wrote in message Show quoteHide quote news:1132915855.600892.50150@f14g2000cwb.googlegroups.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 >
Cool Web Parts?
Newbie - question concerning page behaviour One comment about the implementation of Session FormView DateTime bug?? Problems with Custom Web Controls in VS 2005 DataList Issue Time textbox control TableAdapter Scalar or "Single Value" Queries regular expression Mailto Link in Gridview |
|||||||||||||||||||||||