I want to redirect to another Page When I'm clicking a GridViewRow
I have tried this (with no success) :
[RowName].Attributes["onclick"] = "HttpContext.Current.Response.Redirect('[PageName].aspx')";
How to do that?
Thanks!
I want to redirect to another Page When I'm clicking a GridViewRow
I have tried this (with no success) :
[RowName].Attributes["onclick"] = "HttpContext.Current.Response.Redirect('[PageName].aspx')";
How to do that?
Thanks!
You cannot bind a Response.Redirect to a onclick atrribute directly, only functions. But you cannot bind a function to a row (click). It's easier to use Javascript. It does not require a PostBack.
Bind the javascript onclick function to a row in the
OnRowDataBoundevent of the gridview.And then a JavaScript function.