|
.net
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 >
Other interesting topics
Consuming less memory when writing a file?
run asp.net without a web server Visual Web Developer Express How do I build Code-behind into DLL in bin folder Downloading file from database A translatable website Problem Running ASP.NET/ASP App Under VS 2005 ASP classic -> ASP.NET 2.0 Cannot display Chinese data from database Cannot POST to .XML page specifying a query string in an href dynamically |
|||||||||||||||||||||||