Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Mobile (http://www.velocityreviews.com/forums/f61-asp-net-mobile.html)
-   -   Set focus on mobile page (http://www.velocityreviews.com/forums/t764531-set-focus-on-mobile-page.html)

gmengerink@gmail.com 10-30-2007 11:53 AM

Set focus on mobile page
 
There was an article about setting the focus in a mobile page with
this code:
<mobile:Panel id="Panel1" runat="server">
<mobile:DeviceSpecific id="DeviceSpecific1" Runat="server">
<Choice Filter="isHTML32">
<contenttemplate>
<Script for='window' event='onload' language='jscript'>
window.Form1.TB_Location.focus();
</Script>
</contenttemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:Panel>

This works on my page, but I want to make a page with more than one
textbox
for scanning purpose. Like order numer, article, etc.
I tried to use RegisterStartupScript, with this code:

private void SetFocus(Control FocusControl)
{
string ClientID = FocusControl.ClientID;
System.Text.StringBuilder ScrFocus = new System.Text.StringBuilder();
ScrFocus.Append("<script for='window' event='onload'
language='jscript'>");
ScrFocus.Append("window.Form1.");
ScrFocus.Append(ClientID);
ScrFocus.Append(".focus();");
ScrFocus.Append("</script>");

this.RegisterStartupScript("SetFocus",ScrFocus.ToS tring());
}

So I can call after scanning the first barcode for textbox1
SetFocus(textbox2);
etc etc.
But the code isn't working.
Is there anyone who nows how and where in my code I can call this
script so I can set the focus of the
cursor in the next textbox after scanning?

With kind regards,

G. Mengerink


JD 11-04-2007 12:50 AM

Re: Set focus on mobile page
 
What device are you using?

I know the Blackberry browser does not support focus() for example.


<gmengerink@gmail.com> wrote in message
news:1193745224.823567.259960@19g2000hsx.googlegro ups.com...
> There was an article about setting the focus in a mobile page with
> this code:
> <mobile:Panel id="Panel1" runat="server">
> <mobile:DeviceSpecific id="DeviceSpecific1" Runat="server">
> <Choice Filter="isHTML32">
> <contenttemplate>
> <Script for='window' event='onload' language='jscript'>
> window.Form1.TB_Location.focus();
> </Script>
> </contenttemplate>
> </Choice>
> </mobile:DeviceSpecific>
> </mobile:Panel>
>
> This works on my page, but I want to make a page with more than one
> textbox
> for scanning purpose. Like order numer, article, etc.
> I tried to use RegisterStartupScript, with this code:
>
> private void SetFocus(Control FocusControl)
> {
> string ClientID = FocusControl.ClientID;
> System.Text.StringBuilder ScrFocus = new System.Text.StringBuilder();
> ScrFocus.Append("<script for='window' event='onload'
> language='jscript'>");
> ScrFocus.Append("window.Form1.");
> ScrFocus.Append(ClientID);
> ScrFocus.Append(".focus();");
> ScrFocus.Append("</script>");
>
> this.RegisterStartupScript("SetFocus",ScrFocus.ToS tring());
> }
>
> So I can call after scanning the first barcode for textbox1
> SetFocus(textbox2);
> etc etc.
> But the code isn't working.
> Is there anyone who nows how and where in my code I can call this
> script so I can set the focus of the
> cursor in the next textbox after scanning?
>
> With kind regards,
>
> G. Mengerink
>




gmengerink@gmail.com 11-05-2007 08:34 AM

Re: Set focus on mobile page
 
Thanks for replying.

I'm using an HP iPaq 6915 with windows mobile 5.0


Steveo 11-12-2007 03:32 PM

Re: Set focus on mobile page
 
Hi,
How have you coded your "isHTML32" DeviceFilter in your Web.config?

"gmengerink@gmail.com" wrote:

> Thanks for replying.
>
> I'm using an HP iPaq 6915 with windows mobile 5.0
>
>



All times are GMT. The time now is 12:38 PM.

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