29 July 2008

Identify GridView RowIndex

//When we Click a grdView Row, then row index stored in a hidden Field
function GetGrvPersonalRowIndex(GRVRowIndex)
{
document.getElementById('ctl00_ContentPlaceHolder1_tbcDailyReporting_TabPanel1_HFGridviewRowIndex').value=GRVRowIndex;
}
-------In server side of asp page----------
protected void grvPersonal_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "javascript:GetGrvPersonalRowIndex(" + e.Row.RowIndex + ")");
}
}

No comments: