Set focus on mobile page

G

gmengerink

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.ToString());
}

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
 
J

JD

What device are you using?

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top