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 / March 2004

Tip: Looking for answers? Try searching our database.

Client scripts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
geoff p - 14 Mar 2004 08:21 GMT
How does one implement client-side scripts(<SCRIPT...) using the ASP .NET mobile designer? Is there another way to do client-side validation and avoid a round trip? Have I missed a switch/config item

If I try to specify the script using onclick="myscript()" in a mobile: control I get a compile error that the script doesnt exist

the ClientValidationFunction attribute seems to be missing from all the mobile: controls too

Thank
Geoff p
kefren - 15 Mar 2004 00:31 GMT
How does one implement client-side scripts(<SCRIPT...) using the ASP .NET mobile designer? Is there another way to do client-side validation and avoid a round trip? Have I missed a switch/config item

If I try to specify the script using onclick="myscript()" in a mobile: control I get a compile error that the script doesnt exist

the ClientValidationFunction attribute seems to be missing from all the mobile: controls too

Thank
Geoff
Yan-Hong Huang[MSFT] - 15 Mar 2004 09:34 GMT
Hello Geoff,

You are right here. The validation controls in the Mobile Internet Toolkit
are descended from the similar ASP.NET controls intended for desktop
clients. However, unlike those controls, which might add Javascript into
the Web page sent to desktop browsers to perform client-side validation,
they never execute on the client. Instead, they execute on the server,
after the client posts the form data. If the data is invalid, you can
program against this result or allow ASP.NET to return the page to the user
for correction.

So ClientValidationFunction doesn't exist for validator controls in ASP.NET
mobile programming. In order to achieve client side scripting for
validation, we need to use client side java script to do so. For an
example: (sample code from hs's reply in the newsgroup before)

<mobile:form id="Form9" runat="server">
 <mobile:Panel id="Panel3" runat="server">
  <mobile:DeviceSpecific id="Devicespecific3" runat="server">
   <Choice Filter="isHTML32">
    <ContentTemplate>
     <Script for="window" event="onload" language="jscript">
             window.Form9.TextBox6.focus();
            window.Form9.TextBox6.onchange = text_changed;
              function text_changed(e)
              {
                   alert("you cracked it");
                   document.Form9.reset();
              }
       </Script>
    </ContentTemplate>
   </Choice>
  </mobile:DeviceSpecific>
 </mobile:Panel>
 <mobile:TextBox id="TextBox6" runat="server"></mobile:TextBox>
 <mobile:Command id="Command7" runat="server" BackColor="White"
ForeColor="White"></mobile:Command>
</mobile:form>

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
kefren - 15 Mar 2004 10:01 GMT
Thanks Yanhon

I have seen the templates stuff in msdn and remember seeing a reference to scripts. I think I'll make progress now

Geoff p
Yan-Hong Huang[MSFT] - 15 Mar 2004 10:58 GMT
Hi Geoff,

That is good. I am glad to be of assistance.

Thanks and have a good day. :)

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

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.