write onmouseover on rowdatabound
protected void mygridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex != -1)
{
e.Row.Attributes["onmouseover"] = "showContents('" + (e.Row.RowIndex + 1) + "')";
}
}
{
if (e.Row.RowIndex != -1)
{
e.Row.Attributes["onmouseover"] = "showContents('" + (e.Row.RowIndex + 1) + "')";
}
}
<script type="text/javascript">
function showContents(rowIndex) {
var gv = <%= mygridview.ClientID %>;
var rowElement = gv.rows[rowIndex];
var title = rowElement.cells[0].innerHTML;
alert(rowIndex + ',' + title);
}
function showContents(rowIndex) {
var gv = <%= mygridview.ClientID %>;
var rowElement = gv.rows[rowIndex];
var title = rowElement.cells[0].innerHTML;
alert(rowIndex + ',' + title);
}
No comments:
Post a Comment