dynamic device specific script


    Sponsored Links


  • 1. Sending a SMS to a cell phone
    Hi there! I'm new in .NET development. I'm just curious about something. I want to create an application, so i can send a SMS to a cell phone. A form with two textboxes and a button (textboxes for the phone number and Message and a "SEND" button) Is it possible for any cell phone ? Is it possible without a contract with a company ? Do i have to do anything special, or i just can write some code and launch the application (ofcourse, an internet connection is available :D) ? What should i do ? I ask you this because i don't know any sites where i can send as many SMS as i want. I want to do this. Thankyou very much!

dynamic device specific script

Postby ashelley » Sat, 02 Oct 2004 02:27:42 GMT

I have this in my aspx page:

<mobile:DeviceSpecific id=DeviceSpecific1 Runat="server">
	<Choice Filter="isHTML32">
			<%# ((string)Session["clientScript"]) %>

I have this in my code behind in formload:

Session["clientScript"] = "<Script for=\"window\" event=\"onload\"

But the client script is never added to the page.  My goal is to be
able to dynamically control which control gets focus when the page is
redrawn.  The following works:

<mobile:DeviceSpecific id="DeviceSpecific1" Runat="server">
	<Choice Filter="isHTML32">
			<Script for="window" event="onload"

Anyone have any suggestions?  Any insight is appreciated.


Re: dynamic device specific script

Postby ashelley » Sat, 02 Oct 2004 06:57:17 GMT

as a hack i created multiple devicespecific controls and toggle them
visible as needed.  This was a less than optimal system but it works.

I would have liked the flexibility to dynamically generate the


Re: dynamic device specific script

Postby Conor O'Doherty » Tue, 26 Oct 2004 20:58:16 GMT

Thank you
Thank you
Thank you
Thank you
Thank you Adam

I'm only 3 days into my very first web app, and my first requirement is to 
set focus to my testbox.
Could I have possibly asked for a tougher task.
Finally, after trying all the samples & posts to set focus none of which 
worked for me execpt yours.
I have seen other posts which used the same code but put the script in the 
<FooterTemplate> tag which didn't work for me even though others swear by 
it, changing to <Contexttemplate> tag finally set the focus.

So Adam again Thank you :-)

Best Regards

Similar Threads:

1.Device Specific filter not working.


I am developing a mobile web VB asp.net application in VS 2005. The forms 
are mobile web forms. I have a mobile web configuration page (web.config).
In one of my forms I have a DeviceSpecific control so that I can choose to 
use an asp:TextBox when PocketIE is detected, otherwise I want to use a 
mobile:TextView control.

Here is a snippet of my asp code:

   <mobile:Panel ID="pnlReport" Runat="server" Font-Name="Arial" 
Font-Size="Small" Paginate="True">
      <mobile:DeviceSpecific id="DeviceSpecificEdit" runat="server">
            <Choice Filter="isPocketIE">
                  <asp:TextBox id="txtReport" runat="server" 
TextMode="MultiLine" Rows="5" Wrapping="Wrap"/>
                  <mobile:TextView ID="txtReport" Runat="server" 

Unfortunately the Device Specific filter never works on the Pocket PC 2003 
SE Emulator that ships with VS2005. The asp.net code always runs the default 
choice. I have discovered that the Internet explorer on Pocket PC seems to 
return a MobileCapabilities browser type of "MSIE".

I have looked everywhere for examples and cannot see anything I have done 
wrong. How do I ensure that PocketPc 2003 will run the "isPocketIE" device 
code and not always choose the default choice?

I should note that my web.config file contains amongst it's device filters:
<filter name="isPocketIE" compare="Browser" argument="Pocket IE" />

Has anyone come across this before and discovered what to do. Any help would 
be much appreciated.
Thank you.

2.Write a app that can suspend/resume device in specific time

Hi there,

I'd like to write a program that can suspend ppc and resume it in 10
seconds. Here is what I'm doing, but it don't work. Please have some
comments if you know how to get device resume again. Thanks


// start of code
const int POWER_STATE_ON = 0x00010000;
const int POWER_STATE_OFF = 0x00020000;
const int POWER_STATE_SUSPEND = 0x00200000;
const int POWER_FORCE = 4096;

            public ushort wYear;
            public ushort wMonth;
            public ushort wDayOfWeek;
            public ushort wDay;
            public ushort wHour;
            public ushort wMinute;
            public ushort wSecond;
            public ushort wMilliseconds;

[DllImport("coredll.dll", EntryPoint = "CeRunAppAtTime", SetLastError
= true)]
private static extern bool CeRunAppAtTime(string pwszAppName, ref

EntryPoint="SetSystemPowerState",SetLastError = true)]
private static extern int SetSystemPowerState(string psState, int
StateFlags, int Options);

static void Main(string[] args)
    DateTime wakeuptime = new DateTime(DateTime.Now.Ticks);
    wakeuptime = wakeuptime.AddSeconds(10.0);

    st.wYear = (ushort)wakeuptime.Year;
    st.wMonth = (ushort)wakeuptime.Month;
    st.wDay = (ushort)wakeuptime.Day;
    st.wDayOfWeek = (ushort)wakeuptime.DayOfWeek;
    st.wHour = (ushort)wakeuptime.Hour;
    st.wMinute = (ushort)wakeuptime.Minute;
    st.wSecond = (ushort)wakeuptime.Second;
    st.wMilliseconds = (ushort)wakeuptime.Millisecond;

    bool flag = CeRunAppAtTime("iexplore", ref st);

    SetSystemPowerState(null, POWER_STATE_SUSPEND, POWER_FORCE);
// end of code

3.Waking up device at specific time VB.NET

      Does anyone have any VB.NET code on how to use SetUserNotification to 
wake up a device. I am using VB.NET 2003 and OPENNETCF 1.4. The code I am 
trying to use is:
      Notify = New OPENNETCF.Win32.Notify.UserNotification
      nt = New OPENNETCF.Win32.Notify.UserNotificationTrigger
      nt.Type = NotificationType.Event
      nt.Event = NotificationEvent.Wakeup
      nt.Application = Path & "Invoicing.exe"
      nt.StartTime = dtTime
      intNotificationHandle = 
OPPENNETCF.Win32.Notify.Notify.SetUserNotification(nt, Notify)

      but this gives me the error 'Error setting UserNotification'.
      I am have seen examples in C#, but not being much of a C# programmer, 
I don't really understand what is going on! What I actually want to do is 
wake up the device during the night, perform some overnight processing, then 
set another notification event to do the same thing on the next working day. 
Am I going about it in the right way? Thanks in advance.

      Andy Baker


4.Waking up device at a specific time


I have a VB.NET 2003 compact framework application. The application will be 
running all the time on a mobile device, and part of the requirements is for 
the device to access the main SQL Server 2000 database during the night to 
upload updated data. The device may possibly be in standby mode at this 
point, so if it is, I need to wake it up. I have found some C# code that 
uses the OpenNETCF RunAppAtTime method to run an application at a specified 
time, that I have incorporated into my app, and it does wake up the device 
at the time that I want it to. However, there are a few potential problems 
that I can see with this approach.
    1) I don't want to run an application, my application will be always 
running, so all I need to do is wake up the device. (This doesn't seem to 
    2) I can only set the wake up time to a specific date and time. I want 
it to be every night (or every working night) at the same time. This means 
that I need to set the date and time for the next working day after 
uploading, or on start of the application if it is being run for the first 
Would setting the same reminder more than once cause any problems?
    3) I do not know how to cancel a reminder once set. Is there a way to 
see what reminders have been set - at the moment I am keeping a registry 
entry with the date of the last reminder, and if it has already been set, 
don't do it again.
    3) It seems like a very complicated method, with a great potential for 
mistakes. Is there a better way?
    Unfortunately my C# skills are fairly limited, so although I have got 
the code to work, I am not sure exactly what it is doing. I am concerned 
that it may be causing me problems - I can see the device grinding to a halt 
because I have so many threads running setting reminders all over the place. 
Any advice would be appreciated.

Andy Baker 

5.NSIS and device-specific .cab files?

Another installer question!!
1. I need a windows installer that doesn't require the .net framework to be 
installed on the desktop (unlike the MSDN example Setup project that uses the 
2. NSIS works like a charm but I can only specify one cab file at a time 
(although CeAppmgr handles mulitple device-specific .cab files).

Any ideas?

London, UK

6. determine if a specific USB device is plugged in

7. playing wave files on specific Audio device ?

8. Dynamic cast string value to a specific data type for stored procedure

Return to ASP.NET


Who is online

Users browsing this forum: No registered users and 83 guest