CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 DATAGRID c#/ASP POSTBACK setfocus question

Print topic Send  topic

Author Message
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.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.