how to make gridview rows clickable??
how to make gridview rows clickable?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jun 19, 2012, 2:02 AM
Sameer Approch is good.Insted of you can also use RowDataBound events and in RowDataBound events bind javascript onclick event.
....
....
....
protected void gvSearch_RowDataBound(object sender, GridViewRowEventArgs e)
Also refer{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("style", "cursor:pointer;");
e.Row.Attributes.Add("onclick", "location='patron_detail.aspx?id=" + e.Row.Cells[0].Text + "'");
}
}
http://www.codeproject.com/Articles/15898/Select-a-row-in-a-grid-view-with-a-click-on-row
hope this will help you.
sameer gadadePosted Jun 19, 2012, 1:09 AM
use following line of code
use command field in grid view columns
hope this code will work for you
EX:
CssClass="grid_style" Width="750px"
onpageindexchanging="GridViewteacherdetails_PageIndexChanging"
onrowcreated="GridViewteacherdetails_RowCreated"
onsorting="GridViewteacherdetails_Sorting" AllowSorting="True"
BackColor="White" onselectedindexchanging="GridViewteacherdetails_SelectedIndexChanging"
>