Click here to Skip to main content
13,094,001 members (59,423 online)
Rate this:
Please Sign up or sign in to vote.
hi all
i need to call the code behind the function on blur event the mobilevalidate function is called and working fine.but i need to call the code behind function CheckDateTime. pls help me

<script type="text/javascript">
      function mobilevalidate() {
          if (document.getElementById('<%= txtcallerid.ClientID%>').value != "") {

          if (document.getElementById('<%= txtcallerid.ClientID%>').value.match(/^\d+$/))
//i need to call the code behind function <pre lang="xml">CheckDateTime
                  return true;
                  alert(&quot;Please Enter Valid Caller Id&quot;);
              document.getElementById(&#39;&lt;%= txtcallerid.ClientID%&gt;&#39;).value = &quot;&quot;;
              document.getElementById(&#39;&lt;%= txtcallerid.ClientID%&gt;&#39;).focus();
          alert(&quot;Please Enter Caller Id&quot;);
          return false;

my.cs file
  public static string CheckDateTime(string args)
Posted 28-Mar-13 6:23am
Updated 28-Mar-13 6:39am
Maciej Los255.5K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First you need to take reference of ScriptManager control from your page.
<asp:scriptmanager id="scriptmanager" runat="server"></asp:scriptmanager>

If it is already there to your masterpage then no need. Then from your mobilevalidate method you can call server side method CheckDateTime like as follows

You can also called that serverside method using jquery or other client side library like prototype. If you search online then you will find many codesample.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100