[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

setfocus on mobile textbox for barcode scanning

Robin Prosch via .NET 247

7/3/2004 4:56:00 PM

I am trying to make asimple asp=2Enet mobile Webform, that has one=
textbox, in wich a barcode scanner enters a barcode and a=
"return"

1=2E) How do i get the focus on the textbox on page load ? ( Please=
note that MOBILE textbox control has no setfocus)

Some things that did not work so far on the mobile Webform :
#################################################################=
###
Private Sub SetFocus(ByVal FocusControl As Control)
Dim Script As New System=2EText=2EStringBuilder
Dim ClientID As String =3D FocusControl=2EClientID

With Script
=2EAppend("<script language=3D'javascript'>")
=2EAppend("document=2EgetElementById('")
=2EAppend(ClientID)
=2EAppend("')=2Efocus();")
=2EAppend("</script>")
End With
RegisterStaTextBox id=3D"TextBox1"=
runat=3D"server"></mobile:TextBox>
</mobile:Form>
</body>

But this one get me the following error while executing (sorry=
for german, but i hope you, dear reader, get the point):

[ArgumentException: Auf der Seite "isHTML32", die System=2EBoolean=
zur?ckgibt und System=2EWeb=2EMobile=2EMobileCapabilities und=
System=2EString als Argumente akzeptiert, ist weder eine=
Ger?tefunktion mit dem Namen "isHTML32" noch eine ?ffentliche,=
nicht statische Methode vorhanden=2E]
What do I need to set / do additionally ? Anything about=
devicefilters in web=2Econfig ?

Any hint / help would be highly appreciated=2E

best regards,

Robin rtupScript("setFocus", Script=2EToString())
End Sub
'This works perfect on normal Web Forms !
'############################################################


Another attempt taken from the internet is the followoing :

<%@ Register TagPrefix=3D"mobile"=
Namespace=3D"System=2EWeb=2EUI=2EMobileControls"=
Assembly=3D"System=2EWeb=2EMobile" %>
<%@ Page Language=3D"vb" AutoEventWireup=3D"false"=
Codebehind=3D"MWnyatecSCANInput=2Easpx=2Evb"=
Inherits=3D"NyatecSCANInput=2EMWnyatecSCANInput" %>

<HEAD>
<meta name=3D"GENERATOR" content=3D"Microsoft Visual Studio =2ENET=
7=2E1">
<meta name=3D"CODE_LANGUAGE" content=3D"Visual Basic =2ENET 7=2E1">
<meta name=3D"vs_targetSchema"=
content=3D"http://schemas=2Emicrosoft=2Ecom/Mobile/Page">
</HEAD>

<body Xmlns:mobile=3D"http://schemas=2Emicrosoft=2Ecom/Mobile/WebForm">=

<mobile:Form id=3D"nyatec" runat=3D"server">
<mobile:DeviceSpecific id=3D"DeviceSpecific1" runat=3D"server">
<Choice Filter=3D"isHTML32"=
Xmlns=3D"http://schemas=2Emicrosoft=2Ecom/mobile/html32template">
<ScriptTemplate>
<SCRIPT language=3D"javascript" for=3D"window" EVENT=3D"onload()">
document=2EForm1=2ETextBox1=2Efocus();
</SCRIPT>
</ScriptTemplate>
</Choice>
</mobile:DeviceSpecific>
<mobile:










--------------------------------
From: Robin Prosch

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

<Id>4C6NTa3m/kachTPcSfE5VA=3D=3D</Id>
1 Answer

=?Utf-8?B?LS1Fcmlj?=

7/6/2004 8:58:00 PM

0

Robin,

I'm trying to do exactly the same thing in PIE and have been looking for a solution for three days. Please let me know if you find a solution. I have tried registering a client side script, it works on desktop browser but not on the mobile device.

If anyone has a solution to this one I would be very interested in seeing it.

Thanks

--Eric Cantrall
ecantrall@mckenziesp.com


"Robin Prosch via .NET 247" wrote:

> I am trying to make asimple asp.net mobile Webform, that has one textbox, in wich a barcode scanner enters a barcode and a "return"
>
> 1.) How do i get the focus on the textbox on page load ? ( Please note that MOBILE textbox control has no setfocus)
>
> Some things that did not work so far on the mobile Webform :
> ####################################################################
> Private Sub SetFocus(ByVal FocusControl As Control)
> Dim Script As New System.Text.StringBuilder
> Dim ClientID As String = FocusControl.ClientID
>
> With Script
> .Append("<script language='javascript'>")
> .Append("document.getElementById('")
> .Append(ClientID)
> .Append("').focus();")
> .Append("</script>")
> End With
> RegisterStaTextBox id="TextBox1" runat="server"></mobile:TextBox>
> </mobile:Form>
> </body>
>
> But this one get me the following error while executing (sorry for german, but i hope you, dear reader, get the point):
>
> [ArgumentException: Auf der Seite "isHTML32", die System.Boolean zur?ckgibt und System.Web.Mobile.MobileCapabilities und System.String als Argumente akzeptiert, ist weder eine Ger?tefunktion mit dem Namen "isHTML32" noch eine ?ffentliche, nicht statische Methode vorhanden.]
> What do I need to set / do additionally ? Anything about devicefilters in web.config ?
>
> Any hint / help would be highly appreciated.
>
> best regards,
>
> Robin rtupScript("setFocus", Script.ToString())
> End Sub
> 'This works perfect on normal Web Forms !
> '############################################################
>
>
> Another attempt taken from the internet is the followoing :
>
> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MWnyatecSCANInput.aspx.vb" Inherits="NyatecSCANInput.MWnyatecSCANInput" %>
>
> <HEAD>
> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
> <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/Mobile/Page...
> </HEAD>
>
> <body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm...
> <mobile:Form id="nyatec" runat="server">
> <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
> <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template...
> <ScriptTemplate>
> <SCRIPT language="javascript" for="window" EVENT="onload()">
> document.Form1.TextBox1.focus();
> </SCRIPT>
> </ScriptTemplate>
> </Choice>
> </mobile:DeviceSpecific>
> <mobile:
>
>
>
>
>
>
>
>
>
>
> --------------------------------
> From: Robin Prosch
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotn...)
>
> <Id>4C6NTa3m/kachTPcSfE5VA==</Id>
>