Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Mobile / October 2004

Tip: Looking for answers? Try searching our database.

dynamic device specific script

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ashelley@inlandkwpp.com - 30 Sep 2004 18:27 GMT
I have this in my aspx page:

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

I have this in my code behind in formload:

--------------
Session["clientScript"] = "<Script for=\"window\" event=\"onload\"
language=\"jscript\">window.Form1.txtJump.focus();</Script>";
--------------

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">
        <contenttemplate>
            <Script for="window" event="onload"
language="jscript">
                window.Form1.txtJump.focus();
            </Script>
        </contenttemplate>
    </Choice>
</mobile:DeviceSpecific>
--------------

Anyone have any suggestions?  Any insight is appreciated.

-Adam
ashelley@inlandkwpp.com - 30 Sep 2004 22:57 GMT
>Anyone have any suggestions?  Any insight is appreciated.

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
scripts.

-Adam
Conor O'Doherty - 25 Oct 2004 12:58 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
Conor

>I have this in my aspx page:
>
[quoted text clipped - 35 lines]
>
> -Adam

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.