Click here to Skip to main content
14,930,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Can any one tell me how to fire client side event on selection of gridview row with out using other controls , none of my search brought me result.

Thank you

I don't think the gridview control has any client side events.

... but, as it renders an html table, you can create and attach your own.

Here is an example, which should get you started:[^]

... hope it helps.
Yes ofcourse. Try like below. Use RowDataBound Event.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    //check the item being bound is actually a DataRow, if it is,
    //wire up the required html events and attach the relevant JavaScripts
    if (e.Row.RowType == DataControlRowType.DataRow)
        e.Row.Attributes["onclick"] =

Then write JavaScript function gridRowOnclick.
function gridRowOnclick(element)
    alert("GridView clicked");
Karthik_Mahalingam 8-Jan-14 9:47am
5 good.
Tadit, i thought of posting the same, but after seeing your solution.i stopped. :-)
:D Thanks a lot Karthik. :)
JoCodes 8-Jan-14 10:30am
Good one Tadit:)
Thanks a lot JoCodes. :) Up voting would make me feel happier. :P :D
JoCodes 8-Jan-14 22:24pm
Done. :)
Thanks a lot JoCodes... :)
if posback happens you need to rebind the data to gridview again. many limitations
CHill60 14-Jul-20 8:24am
This is not a solution to this question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900