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

  • Home
  • SEARCH
  • 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 8985439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:19:49+00:00 2026-06-15T21:19:49+00:00

in my asp.net application I have a button that when clicked calls a javascript

  • 0

in my asp.net application I have a button that when clicked calls a javascript function. This function uses pagemethods to call a server side function in the VB code behind. This works correctly and at the end of the function I am returning a string. When the success function hits on the client side – the return value is always null. Is anyone seeing the issue? Listed below are pieces of the code to see how this is working. Thank you.

Button

<asp:button id="btnSaveSoln" onclientclick="refreshParentTree()" runat="server" Text="Save" Cssclass="smalltextbutton"></asp:button>

refreshParentTree Javascript

function refreshParentTree() {

var chkUpdate = document.getElementById('chkUpdatePlanner');
var chkValue;
if (chkUpdate != null) {
    if (document.getElementById('chkUpdatePlanner').checked = true) {
              chkValue = 1;
    }
    else {
              chkValue = 0;
    }
}
else {
    chkValue = 0;
}

var txtClient = document.getElementById('txtClientID');
var txtClientValue;
if (txtClient != null) {
    txtClientValue = document.getElementById('txtClientID').value;
}
else {
    txtClientValue = '';
}


PageMethods.save(document.getElementById('hdnProjectCreator').value,     document.getElementById('txtTitle').value, document.getElementById('txtDescription').value, document.getElementById('hdnProjectManager').value, document.getElementById('txtSchedStart').value, document.getElementById('hdnApprover').value, document.getElementById('dropdownProjectType').value, document.getElementById('drpdownProjectPriority').value, txtClientValue, 0, document.getElementById('DropDownPhaseList').value, chkValue, document.getElementById('DropDownWorkWeekLengthList').value, document.getElementById('hdnTemplateID').value, saveSuccess, saveFailure);
}

save function on server side (VB)

 <System.Web.Services.WebMethod()> _
    Public Shared Function save(ByVal hdnProjCreator As String, ByVal titleTxt As String, ByVal desc As String, ByVal hdnProjManager As String, ByVal SchedStart As String, ByVal ApproverTxt As String, ByVal ddProjectType As String, ByVal ddProjectPriority As String, ByVal ClientIDtxt As String, ByVal ddEquipmentList As String, ByVal ddPhaseList As String, ByVal UpdatePlanner As String, ByVal ddWorkWeekLengthList As String, ByVal TemplateID As String)
    ***** SQL Computing here, removed for stack overflow - ddWorkWeekVisable, lnResult, parentID and taskgrpPCat are all strings *****  

        Dim returnString As String = ddWorkWeekVisable & ":" & lnResult & ":10:" & parentID & ":" & taskgrpPCat
        Return returnString


    End Function

From here when the success function hits, I have used an alert to see the value of the return string, I am always getting null – success JS function

function saveSuccess(response) {
alert('save success hit - response: ' + response)
}

Also, I am importing the following on the server side

Imports System.Data.SqlClient
Imports System.Web.Configuration
Imports System.Web.Services
Imports System.Web.Services.WebMethodAttribute
Imports System.Web.SessionState.SessionStateMode
Imports System.Web.UI.WebControls
Imports System.Web
Imports System.Data

I have also included the below script manager on the client side

 <asp:ScriptManager ID="ScriptManager1" runat="server"   
      EnablePageMethods="True">
</asp:ScriptManager>

Thank you for your help. I have used pagemethods often in the past, but I can’t seem to figure out why I’m always reutrning null in this case. Thanks again.

  • 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-06-15T21:19:50+00:00Added an answer on June 15, 2026 at 9:19 pm

    Issue Resolved, issue was in the server side function, can not use httpcontext.current.response.write – this was throwing off the return

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

Sidebar

Related Questions

I have an ASP.NET MVC application that uses LINQ2SQL as the database layer. I
net/C# application I have a Link button: <asp:LinkButton runat=server ID=LinkButton1/> When the user clicks
I use yui datatable in my asp.net application... I have a link button in
I am developing a mobile web application in asp.net. I have a button in
i have developed a web application asp.net C#. on a button click i am
I have an ASP.NET button in my application, which I want to open another
in a ASP.NET application (MVC) I have a foreach loop that loops through a
In my ASP .NET MVC application i have a link that refreshes the preview
I have an ASP.NET MVC application that displays a list of items. In my
I have an ASP.NET web app that uses a single page, but makes some

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.