Hi Everyone.
I'm using asp.net 2.0, .net framework 3.5...
I've got a gridview control with normal command buttons and I've used GetPostBackEventReference to add an event against an entire row, where when enter is pressed against the row during edit, it automatically saves.
However, the problem I'm getting is that, when pressing enter, the record saves, but the edit index on the gridview is set to 0, i.e. the edit mode jumps to the first row, instead of no rows being edited.
If I use the standard command buttons, then this doesn't happen. If I'm already editing the first row, then it doesnt' happen.
Also, this doesn't happen in firefox.
Anyone got any ideas of why this is happening and how to stop it?
Thanks
relevant code snippet
--------------------
Procrastinate Now!
I'm using asp.net 2.0, .net framework 3.5...
I've got a gridview control with normal command buttons and I've used GetPostBackEventReference to add an event against an entire row, where when enter is pressed against the row during edit, it automatically saves.
However, the problem I'm getting is that, when pressing enter, the record saves, but the edit index on the gridview is set to 0, i.e. the edit mode jumps to the first row, instead of no rows being edited.
If I use the standard command buttons, then this doesn't happen. If I'm already editing the first row, then it doesnt' happen.
Also, this doesn't happen in firefox.
Anyone got any ideas of why this is happening and how to stop it?
Thanks
relevant code snippet
Code:
protected void RowDataBound(object sender, GridViewRowEventArgs e)
{
...
string update = ClientScript.GetPostBackEventReference(btnSave, "") + "; ";
e.Row.Attributes.Add("onkeypress", "if(event.keyCode == 13) { " + update + "}");
...
}
--------------------
Procrastinate Now!