Mobile forms an Javascript

Discussion in 'ASP .Net Mobile' started by Walter, Jan 11, 2005.

  1. Walter

    Walter Guest

    I renew here an old question:
    I access a server side web application using I.E., and the Symbol Pocket PC
    PPT8800 (Microsoft Pocket PC V. 4.20.0 on ARM XScale).
    I need to set focus on one text control on the page load, and to refresh the
    client page every n seconds.
    I've found this is a very simple job to do with ASP.NET and web forms, using
    a client side Javascript code , registred by the RegisterStartupScript().
    This is the VB function I call in the Page_PreRender() event manager:

    Private Sub RegisterRefreshScript()
    If Not IsStartupScriptRegistered("autoPostBack") Then
    Dim refreshRate As Integer
    refreshRate = Convert.ToInt32(5000) ' do it
    all 5 seconds !
    Dim scriptBlock As StringBuilder = New StringBuilder()
    scriptBlock.Append("<script language=JavaScript>")
    scriptBlock.Append("function sessionlive_autoPostBack(){")
    scriptBlock.Append("__doPostBack('LinkButton1','');")
    scriptBlock.Append("}")

    scriptBlock.Append("window.setInterval('sessionlive_autoPostBack()',")
    scriptBlock.Append(refreshRate.ToString())
    scriptBlock.Append(");")
    scriptBlock.Append("document.getElementById('TextBox1').focus();")
    scriptBlock.Append("</script>")
    RegisterStartupScript("autoPostBack", scriptBlock.ToString())
    End If
    End Sub

    This works fine in ASP.NET and web forms, but it does not work at all using
    ASP.NET and Mobile Forms, where you can't find any javascript present in the
    final HTML page, also if you hard-code the javascript by hand!

    Please, can you give me any suggestion? maybe I have to use WML script?
    there is something wrong in my code?

    TIA
    Walter.
     
    Walter, Jan 11, 2005
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.