Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   AutoPostBack and Focus... (http://www.velocityreviews.com/forums/t771740-autopostback-and-focus.html)

Pai 11-12-2003 11:16 PM

AutoPostBack and Focus...
 
Hello there,

I have a DropDown ListBox which is placed at the bottom of the .aspx
page, The AutoPostBack propoerty of the DropDown ListBox is set to
true.

When I change the selection of the elements in
the dropdown list box the top section of the page gets visible,
becuase the page has been posted back.

I need the focus to go to the Drop Down List Box.

I have the following code placed in the Page_Load event of the form...

this.SetFocus( this.DropDownList1 );

and the SetFocus function as follows

protected void SetFocus( System.Web.UI.Control ctrl )
{
string s = "<SCRIPT
language=\"javascript\">document.getElementById('"
+ ctrl.ID + "').focus() </SCRIPT>";

RegisterStartupScript("focus", s );

}

The focus does get set I belive to the DropDown list box, I am not
sure as when I press the tab button it goes to the next control so I
am asssuming the control has got the focus. The top section of the
page is visible, the user in such a case would be lost as to what has
happened.

I need the dropdown list box to be visible on the screen...

Thanks in advance,
Pai

susie 11-14-2003 03:37 AM

AutoPostBack and Focus...
 
This line of code will help you:
<%@ Page Language="VB" SmartNavigation="true"%>

>-----Original Message-----
>Hello there,
>
>I have a DropDown ListBox which is placed at the bottom

of the .aspx
>page, The AutoPostBack propoerty of the DropDown ListBox

is set to
>true.
>
>When I change the selection of the elements in
>the dropdown list box the top section of the page gets

visible,
>becuase the page has been posted back.
>
>I need the focus to go to the Drop Down List Box.
>
>I have the following code placed in the Page_Load event

of the form...
>
>this.SetFocus( this.DropDownList1 );
>
>and the SetFocus function as follows
>
>protected void SetFocus( System.Web.UI.Control ctrl )
>{
> string s = "<SCRIPT
>language=\"javascript\">document.getElementById(' "
> + ctrl.ID + "').focus()

</SCRIPT>";
>
> RegisterStartupScript("focus", s );
>
>}
>
>The focus does get set I belive to the DropDown list box,

I am not
>sure as when I press the tab button it goes to the next

control so I
>am asssuming the control has got the focus. The top

section of the
>page is visible, the user in such a case would be lost as

to what has
>happened.
>
>I need the dropdown list box to be visible on the

screen...
>
>Thanks in advance,
>Pai
>.
>



All times are GMT. The time now is 10:49 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.