ranjan
|
Posted: 11/15/2005, 12:35 PM |
|
I have a DataGrid bound to a dataset, with edititemtemplate for ADDNEW, EDIT, UPDATE, CANCEL.
ALL the logic is in place and works well. Just one issue is confusing me.
On my page there are 20 possible rows. so paging seems silly. but without paging, the focuson every postback goes back to the top of the web page. I want the focus to go to the appropriate row currently being added/changed - U understand?
when the user clicks ADDNEW, a new blank row is added and the page posts back correctly in edit mode for the newly created row.
The problem is that the focus of the page returns to the TOP leaving the newly created row some way down the page, often off screen. Of course the user can use the scrollbar to locate the new row and edit it.
The Question is HOW DO I SET THE FOCUS to the newly created row in the datagrid automatically. (Both for ADDNEW/ EDIT and when I refresh the page.) on postback.
Do i use an anchor ? I do not wish to resort to javascript unless necessary. this is on click of the linkbutton for ok/cancel/update etc. and a postback occurs. I need to set the focus to the correct part of the page. would it be in the onitemcreated event ? what would be the syntax?
any help much appreciated.
|
|
|
|