Click here to Skip to main content
11,805,316 members (66,060 online)
Rate this: bad
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 6:23am
Edited 28-Mar-13 6:39am
Maciej Los202.4K

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
0 OriginalGriff 315
1 Sergey Alexandrovich Kryukov 200
2 Richard Deeming 200
3 CPallini 160
4 CHill60 150
0 OriginalGriff 3,265
1 Maciej Los 1,990
2 KrunalRohit 1,907
3 CPallini 1,855
4 Richard MacCutchan 1,227

Advertise | Privacy | Mobile
Web04 | 2.8.151002.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