Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7492189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:23:24+00:00 2026-05-29T16:23:24+00:00

Im struggling to get a web method to work in VB. The javascript gets

  • 0

Im struggling to get a web method to work in VB. The javascript gets called but never seems to call the web method. I am running in debug mode and get no errors.

Here is the code:

      <System.Web.Services.WebMethod()>
   Public Shared Sub PasteEvent(EventID As Integer, 
                                startDate As DateTime, 
                                endDate as DateTime, 
                                newStart As DateTime)

      ' work out the diff between start and end
      Dim difference As long = DateDiff(DateInterval.Minute,startDate,endDate)

      ' pasteStart  + minutes from the event start
      ' this is because we can only paste on the hour, but events may have started after the hour
      ' ie 10:15
      newStart.AddMinutes(startDate.Minute)

      ' new end = pastestart + diff
      Dim newEnd As DateTime = newStart.AddMinutes(convert.ToDouble(difference))

      ' call database 
      Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("Blueprint").ToString())


      Dim cmd As New SqlCommand
      cmd.CommandType = CommandType.StoredProcedure
      cmd.CommandText = "spOPSCopyEvent"

      cmd.Parameters.AddWithValue("@EventID", EventID)
      cmd.Parameters.AddWithValue("@StartDate", newStart)
      cmd.Parameters.AddWithValue("@EndDate", newEnd)

      cmd.Connection = conn

      conn.Open()

      cmd.ExecuteNonQuery()

      conn.Close()


   End sub

The javascript that calls it:

 <script type="text/javascript" language="javascript">

      function eventCopy(eventID, start, end)
      {
         alert("copy");
         // grab the event id and store it in a hidden text box
         $("#ctl00_MainContent_hidCopyEventID").val(eventID);
         $("#ctl00_MainContent_hidCopyStart").val(start);
         $("#ctl00_MainContent_hidCopyEnd").val(end);
      }

      function eventPaste(eventStart)
      {
         alert("paste");
         alert(eventStart);
         // Call a web method, passing the eventID and the new start time
         var eventID = $("#ctl00_MainContent_hidCopyEventID").val;
         var startDate = $("#ctl00_MainContent_hidCopyStart").val;
         var endDate = $("#ctl00_MainContent_hidCopyEnd").val;

         PageMethods.PasteEvent(eventID, startDate, endDate, eventstart)
      }

   </script>

So far I have :

Updated my script manager in the master page to have enablePageMethods="true"

Tried adding Imports System.Web.Services

Moved the javascript into the body rather than the head

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:23:25+00:00Added an answer on May 29, 2026 at 4:23 pm

    The problem is that you are missing exception handling mechanism to
    see what error did you get .

    1. Put try and catch in javascript and vb code and print the error.

    2. Use the sniffer like Fidler to see what you are sending .

    3. Try to print trace messages in web services using
      Trace.Log and you can see them after running DebugView and see where you are falling

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling to get Windows Live Web Authentication running on Google App Engine (GAE)
I have been struggling to get my jquery call to a webmethod to work.
I am struggling to get a subsonic select query to work, I am writing
I'm trying to make some text bold using HTML, but I'm struggling to get
This is a pretty vague question but I'm struggling a bit to get my
I'm struggling to get a subversion post commit hook to work. When I commit,
I'm struggling to get web.config transformations working with automated builds. We have a reasonably
I have been struggling to get an web application to run in the root
I'm struggling to get around the 404 errors from asp.net mvc beta when deploying
I've been struggling to get a Java program to connect to MS SQL Server,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.