title: How to pass page or master page object to AJAX page method
body: <p>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.</p>
  
  <p>Please see my code</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
      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) {  }
  &lt;/script&gt;
  
  &lt;System.Web.Services.WebMethod()&gt; _
  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
  </code></pre>
  
  <p>But I am getting compiler error when use <code>Page.Master</code>:</p>
  
  <blockquote>
    <p>Reference to non-shared member requires an object reference</p>
  </blockquote>
  
  <p>How to pass Master Page object or Page to Page method?. So I can use in Sared method.</p>
  
  <p>Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.</p>