HighTechTalks DotNet Forums  

Set focus on mobile page

ASP.net Mobile microsoft.public.dotnet.framework.aspnet.mobile


Discuss Set focus on mobile page in the ASP.net Mobile forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
gmengerink@gmail.com
 
Posts: n/a

Default Set focus on mobile page - 10-30-2007 , 06:53 AM






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


Reply With Quote
  #2  
Old   
JD
 
Posts: n/a

Default Re: Set focus on mobile page - 11-03-2007 , 07:50 PM






What device are you using?

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


<gmengerink (AT) gmail (DOT) com> wrote

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




Reply With Quote
  #3  
Old   
gmengerink@gmail.com
 
Posts: n/a

Default Re: Set focus on mobile page - 11-05-2007 , 02:34 AM



Thanks for replying.

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


Reply With Quote
  #4  
Old   
Steveo
 
Posts: n/a

Default Re: Set focus on mobile page - 11-12-2007 , 09:32 AM



Hi,
How have you coded your "isHTML32" DeviceFilter in your Web.config?

"gmengerink (AT) gmail (DOT) com" wrote:

Quote:
Thanks for replying.

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



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.