asp .net mobile + javascript

A

ana.durantez

Hi everyone!
i'm developing a small web application for a Pocket PC Symbol (Windows
Mobile 5.0).
This terminal has got a barcode scanner.
The application mainly works in this way: A barcode is read with the
scanner and written in a textbox. If it isn't the expected barcode,
any beep (i have a .wav file) sounds.

I have two problems and i think javascript is the solution:
- To put the focus on the texbox when on the load of the page.
- To make the beep sounds in the terminal.

I have had a look similar problems in many forums and the given
solutions either they doesn't work for me or i'm applying them in a
bad way.

I have found an example of how to use javascript with asp .net mobile,
it was aout a textox and a label that works as a character counter,
when a character was written in the textbox, the label was updated. I
copied the example and it works in my portatil but not in the
terminal, only the textbox appears in the web page. The example is the
following one:

Test_Javascript_CSharp.aspx
<%@ Register TagPrefix="mobile"
Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<mobile:Form ID="Form1" Runat="server">
<mobile:DeviceSpecific ID="DeviceSpecific3" Runat="server">
<Choice Filter="supportsJavaScript" Xmlns="http://
schemas.microsoft.com/mobile/html32template">
<ScriptTemplate>
<script type="text/javascript">
<!--
function ShowTypedText(txt1, l1) {
document.getElementById(l1).innerHTML =
document.getElementById(txt1).value.length;
}
//-->
</script>
</ScriptTemplate>
</Choice>
</mobile:DeviceSpecific>
<mobile:panel ID="Panel1" Runat="server">
<mobile:DeviceSpecific ID="DeviceSpecific1"
Runat="server">
<Choice Xmlns="http://schemas.microsoft.com/mobile/
html32template">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" />
</br>
<asp:TextBox ID="TextBox1" runat="server"></
asp:TextBox>
</ContentTemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:panel>
</mobile:Form>
</body>
</html>


Test_Javascript_CSharp.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class wap_Test_JavaScript2_CSharp :
System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{
System.Web.UI.WebControls.TextBox tBox1 =
Panel1.Content.FindControl("TextBox1") as
System.Web.UI.WebControls.TextBox;
System.Web.UI.WebControls.Label l1 =
Panel1.Content.FindControl("Label1") as
System.Web.UI.WebControls.Label;
tBox1.Attributes.Add("onkeyup", "javascript:ShowTypedText('" +
tBox1.ClientID + "','" + l1.ClientID + "')");
}
}



Maybe this example is uncompleted to make it work in a pocket pc? How
can i apply it for my case?

I would thank any help!
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top