Server Click in table

C

Chris Zopers

Hello,

I would like to know if it is possible to use a ServerClick event on a
tablerow. I have a HTML table and I would like to handle an event on the
server when the user clicks on a row in the table.

I could use the GridView, but then I have to add a new Select column and
I don't want a new column for selecting a row. A user should be able to
click on any column in the row to fire the event on the server (not a
javascript function).

Greetings,
Chris
 
E

Eliyahu Goldin

Go ahead and add a Select column as the first column in the grid. Hide the
Select column with Visible=false. Handle RowDataBound event and run this
code for every data row:

e.Row.Attributes["onclick"] = this.GetPostBackEventReference
(e.Row.Cells[0].Controls[0]);

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top