[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

gmengerink

10/30/2007 11:54:00 AM

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

3 Answers

JD

11/4/2007 12:51:00 AM

0

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.googlegroups.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.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
>


gmengerink

11/5/2007 8:35:00 AM

0

Thanks for replying.

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

Steveo

11/12/2007 3:32:00 PM

0

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
>
>