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 7429155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:55:27+00:00 2026-05-29T08:55:27+00:00

I have a JSON object that I need to pass from the server to

  • 0

I have a JSON object that I need to pass from the server to the client side to save the data off in a database.

I can sucessfully pass it using:

var str2 = JSON.stringify({
    o: oJSON
});

$.ajax({
    type: "POST",
    url: "WebForm1.aspx/Test",
    data: str2,
    processData: false,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) {},
    error: function (e) {
        alert(e);
    }
});

and

<System.Web.Services.WebMethodAttribute(),               
System.Web.Script.Services.ScriptMethodAttribute()> _
Public Shared Function Test(ByVal o As RootObject) As String
    Dim strName as string = textboxName.text
End Function

I have to save two different sets of data off. The first set has to be saved before the json object can be saved. It is justing saving textbox values to the database. The second set is storing the json to the database.

I am trying to set sName to equal the textbox value and am getting the following error:

Cannot refer to an instance member of a class from within a shared
method or shared member initializer without an explicit instance of
the class

Is there another way to pass the JSON object to the client side where I can access the textbox values on the page ?
Or am I going to have to include Name along with the other values that I need in the JSON object ?

  • 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-29T08:55:28+00:00Added an answer on May 29, 2026 at 8:55 am

    No, you won’t be able to access your Page’s TextBox controls from the static/Shared method. In order for them to have access to that, the AJAX call would have needed to pass the entire ViewState back and run the Page through its life cycle in order to instantiate the TextBox and determine what its value should be. At that point, you’d basically have the UpdatePanel, and would have lost the performance advantages of using page methods.

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

Sidebar

Related Questions

Hi I have a JSON object that is a 2-dimentional array and I need
I have an AJAX application that downloads a JSON object and uses the data
I have a lot of JSON data I need to pass to a request:
I need to get data from JSON, transferred by Ajax from the client. Basically
I have a json object collection of geo locations that I build in the
I have a request that returns a JSON object with a single property which
I have a controller method that returns a jSON object and in one calling
I have a stdClass object created from json_decode that won't return the right number
I have created a json object from ruby with cobravsmongoose, however the attributes have
I have a object that im serializing to a JSON object using JSON.Net. This

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.