asp .net mobile + javascript
am 31.03.2008 11:55:16 von ana.durantezHi 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"
%>
asp:TextBox>
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!