Hi,
you can add javascript to labels by having code like:
Label1.Attributes.Add("onclick","alert('Label was clicked')")
e.g you could wire client-side script to do the stuff, in case that works
well enough. For server-side clicks to be raised you indeed need a Button or
a custom control (can implement IButtonControl interface or do it just by
causing postback from the click)
Developing a row-clickable GridView gives starters (it' s easy to adapt to
getting clicks from cells) if you'd want to do it that way
http://aspadvice.com/blogs/joteke/ar.../07/14576.aspx
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke http://teemukeiski.net
"Durango2008" <el********@yah00.c0mwrote in message
news:1i***************@nlpi061.nbdc.sbc.com...
Hi, I have a Gridview which contains data derived from DB table within
each cell.
The cells are created using ItemTemplate containing Labels used for
displaying the data. What I would like to know is if there is a way to be
able to click on the cell to have the data display in another location on
the page?
I could not figure out how to do this so I instead made the labels into
buttons and used the onClick event, which worked fine.
The problem with buttons is, it does not look good within the Gridview
cells, I would rather somehow use Labels to achieve this.
If anyone can help me out I would appreciate it :)
Thank you very much.