Jan 20 2010

gridview row double click event

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes.Add(”ondblclick”, “javascript:return GetCellValue(’” + e.Row.Cells[0].Text.Replace(”‘”, “””) + “‘);this.style.font=’Italic 12pt helvetica’;this.style.color = ‘Gray’;”);
}

}
The javascript function will look like this

<script type=”text/javascript”>
function ShowDbClkCellVal(JobId)

{

//Getting Current cell value

document.getElementById(’<%=txtSupplierName.ClientID%>’).value = JobId;
//var sURL = ‘http://localhost:1342/lwtServer/Default.aspx?JobID=’ + JobId;

//myWindow = window.open(sURL, ‘Current_Log’,'toolbar=no,menubar=no,resizable=no,scrollbars=yes,status=no,location=no,width=800,height=600′);

//myWindow.moveTo(75,50);
return false;

}

function GetCellValue(RowIndex)
{
ShowDbClkCellVal(RowIndex);

}
</script>

Alibi3col theme by Themocracy