.NETGURU
setfocus on mobile textbox for barcode scanning
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.mobile.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Robin Prosch via .Net Guru (VIP)
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 Guru (http://www.dot-net-guru.com/)

<Id>4C6NTa3m/kachTPcSfE5VA==</Id>
Reply to this message...
 
    
--Eric (VIP)
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
Click here to reveal e-mail address

"Robin Prosch via .Net Guru" wrote:

[Original message clipped]

Reply to this message...
 
 
System.ArgumentException
System.Boolean
System.String
System.Text.StringBuilder
System.Web.Mobile.MobileCapabilities
System.Web.UI.MobileControls.DeviceSpecific
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification