locked
Calling javascript from asp.net mobile controls RRS feed

  • Question

  • User969356990 posted

    Hi,

    I am using mobile controls in my asp.net web pages. The below is the design of my mobile command control.

    <mobile:Command ID="cmdnextC" OnClick="Next" SoftkeyLabel="Next" Runat="server">Next</mobile:Command>

    I have a javascript which i am using to get the GPS location information. And my javascript is like below..

    <script type="text/javascript">
    //<Script for="window" event="onload" language="jscript">
    var modeCellsite   = 0;
    var modeAssisted   = 1;
    var modeAutonomous = 2;
    function locationChanged()
    {
        alert("Lat " + blackberry.location.latitude + " Lon " + blackberry.location.longitude +" Time " + blackberry.location.timestamp );
        return true;
    }
        if (window.blackberry && blackberry.location.GPSSupported) {
            var isUpdated = false;
            var theCount = 0;
            alert("Location tracking is supported");
            blackberry.location.onLocationUpdate("locationChanged()");
            blackberry.location.setAidMode(modeAutonomous);
            while (theCount++ < 10 && !isUpdated)
                isUpdated = blackberry.location.refreshLocation();
        }
        else {
            document.write("Location tracking is not supported");
           
            
        }
    </script>


    <script type="text/javascript">

    var modeCellsite   = 0;

    var modeAssisted   = 1;

    var modeAutonomous = 2;


    function locationChanged()

    {

        alert("Lat " + blackberry.location.latitude + " Lon " + blackberry.location.longitude +" Time " + blackberry.location.timestamp );

        return true;

    }


        if (window.blackberry && blackberry.location.GPSSupported) {

            var isUpdated = false;

            var theCount = 0;


            alert("Location tracking is supported");


            blackberry.location.onLocationUpdate("locationChanged()");

            blackberry.location.setAidMode(modeAutonomous);


            while (theCount++ < 10 && !isUpdated)

                isUpdated = blackberry.location.refreshLocation();

        }

        else {

            document.write("Location tracking is not supported");


        }


    </script>


    Please tell me "How to call this javascript from the command control."

    Tuesday, December 14, 2010 1:37 AM

Answers

All replies