protected override void OnRowCreated(GridViewRowEventArgs e)
{
base.OnRowCreated(e);
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onClick"] = "this.style.cursor = 'wait';"
+ Page.ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex.ToString(), true);
}
}
And how do you handle the click? Just hook up to the GridView's SelectedIndexChanged event handler and check the GridView.SelectedValue property.
ps. for row-hover and striping fun, why not use JQuery? Just implement the grid's RowStyle.CssClass (e.g. set it as 'zootGridRow') and set some style directives to handle the following classes...
$(function() {
// Implement grid-row striping
$('#myGrid .zootGridRow:odd').addClass('zootGridAlternateRow');
// Implement grid-row hover animation
$('#myGrid .zootGridRow').hover(function(){$(this).addClass('zootGridRowHover')},
function(){$(this).removeClass('zootGridRowHover')});
});
No comments:
Post a Comment
Comments are very welcome but are moderated to prevent spam.