Barcode scanning on mobile WebForm - Setfocus issue on Textbox
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.mobile.

Post a new message to this list...

DotNetJunkies User
Hi,

Does anybody have a small sample solution for setting on page load the focus in a textbox on a mobile webform ?

This is required in order to be able to use a barcode scanner, who will enter data in this field ( ending with a tab or enter)

As soon as the data is entered this way, how can i raise a postback, so I get the server back to the server ?

Remark :
As the textbox on a mobile webform has no setfocus method the below code is mentioned as solution for setting the focus on a textbox on a mobile webfrom on several forums. BUT..
I dont get it working, because nowbody states the correct
<deviceFilters> setting in the web.config...

Please help !

<mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
<Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template";;>
<FooterTemplate>
<script for="window" event="onload" language="javascript">
<!--
window.document.Form1.txtFileNumber.focus();
// -->
</script>
</FooterTemplate>
</Choice>
</mobile:DeviceSpecific>

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Reply to this message...
 
    
Gybas Petr
Hi,

I'm actually writing the same application - ASP.NET application working with
bar code scanner. Here is form, that works fine:

<mobile:Form id="FormEANFind" runat="server" Paginate="True"
PagerStyle-NextPageText="->" PagerStyle-PreviousPageText="<-"
StyleReference="Form">
<mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
<Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template";>
<HeaderTemplate>
<mobile:Link id="LinkEANIndex" runat="server"
NavigateUrl="index.aspx">Index</mobile:Link>
</HeaderTemplate>
</Choice>
</mobile:DeviceSpecific>EAN:
<mobile:TextBox id="edtEAN" runat="server"></mobile:TextBox>
<mobile:Command id="btnSubmitEAN" runat="server">Find</mobile:Command>
<mobile:Label id="lblEANError" runat="server"
StyleReference="error"></mobile:Label>
<mobile:Panel id="Panel1" runat="server">
<mobile:DeviceSpecific id="DeviceSpecific5" runat="server">
<Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template";>
<ContentTemplate>
<Script for="window" event="onload" language="jscript">
window.FormEANFind.edtEAN.focus();
</Script>
</ContentTemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:Panel>
</mobile:Form>

But trouble is to handle onchange event and take some action. I found on
Internet, that you should use such script (for example):

window.FormEANFind.edtEAN.onchange = text_changed;
function text_changed(e)
{
window.FormEANFind.btnSubmitEAN.click();
}

It looks so fine, but it doesn't work. I'll post question in this newsgroup,
so check it for possible answer from another user.

pgyb

"DotNetJunkies User" <Click here to reveal e-mail address> wrote in message
news:Ou$Click here to reveal e-mail address...
[Original message clipped]

webfrom on several forums. BUT..
[Original message clipped]


Reply to this message...
 
 
System.Web.UI.MobileControls.DeviceSpecific
System.Web.UI.MobileControls.PagerStyle
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com