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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:47:56+00:00 2026-05-17T14:47:56+00:00

I wrote a page Page method in my aspx page. in web service method

  • 0

I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.

Please see my code

<script type = "text/javascript">
    function ShowCurrentDateTime() {
        $.ajax({
            type: "POST",
            url: "HRDefault.aspx/GetDate",
            data: '',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess,
            failure: function(response) {
                alert(response.d);
            }
        });
    }

    function OnSuccess(response) {  }
</script>

<System.Web.Services.WebMethod()> _
Public Shared Function GetDate() As String
    Dim txt22_2 As TextBox = CType(RenderControls.FindControlRecursive
(Page.Master, "txt22_2"), TextBox)
        Dim str As String
        str = txt22_2.Text
    Return String.Empty
End Function

But I am getting compiler error when use Page.Master:

Reference to non-shared member requires an object reference

How to pass Master Page object or Page to Page method?. So I can use in Sared method.

Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.

  • 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-17T14:47:57+00:00Added an answer on May 17, 2026 at 2:47 pm

    don’t know about $.ajax, but this works fine for me:

    <asp:ScriptManager runat="server" EnablePageMethods="true" />
    <!-- ...................... -->
    <script type="text/javascript">
        function ShowCurrentDateTime() {
            x = document.getElementById('<%= TextBox1.ClientID %>').value;
            PageMethods.GetDate(x, OnSuccess, OnFailure);
        }
        function OnSuccess(response) {
            alert(response);
        }
        function OnFailure(response) {
            alert(response._message);
        }
    </script>
    

    and in code behind:

    <System.Web.Services.WebMethod()> _
    Public Shared Function GetDate(x as String) As String
        ' do something with x
        ' u can add more params if you need
        Return String.Empty
    End Function
    

    hope the syntax is ok, i don’t remember much of vb 😛

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

Sidebar

Related Questions

I wrote a google map lookup page. Everthing worked fine until I referenced the
I'm trying to write a Selenium test for a web page that uses an
I have a ASP.NET (C#) web page which utilizes a VB class library. The
I just wrote some new utility methods within a non-page class for an existing
By convention, all my web site's .aspx files also have corresponding .css files at
Can a firefox XPCOM component read and write page content across multiple pages? Scenario:
I want to write a page that will show all the records from a
I'm trying to write a page that calls PHP that's stored in a MySQL
Does there exist a way to catch a write into write-protected page? I plan
I'm trying to write javascript to find page elements relative to a given element

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.