Click here to Skip to main content
11,922,641 members (32,530 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0 jQuery
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 7:23am
Edited 28-Mar-13 7:39am

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 | Mobile
Web04 | 2.8.151125.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2015
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