title: Embeding web service method to the .ascx(user control)
body: <p>It didn't work and i think it won't but i wanted to ask you(last chance).</p>
  
  <p>I have a simple ascx file. It has one select element which retrieves sub categories when it is selected (over web service).
  I want to write my web method in ascx.cs file instead of to write in other asmx file.</p>
  
  <p>ASCX.CS file </p>
  
  <pre><code>protected void public Page_Load(....){
     //(because i can't give the ascx file path :)
      TheAspxFileWhichContainsMyUserControl = Request.Url.LocalPath
  }
  
  [WebMethod]
  static public string f_GetSubCats(int _iCatId){
      return "&lt;select&gt;&lt;option value=1&gt;One&lt;/option&gt;&lt;/select&gt;";
  }
  </code></pre>
  
  <p>ASCX file:</p>
  
  <pre><code>&lt;script type="..."&gt;
      $.ajax({
          url: "&lt;%=TheAspxFileWhichContainsMyUserControl%&gt;/f_GetSubCats",
          data:...
          ...........
          success: function(msg){
              // append new select to the container
          }
      })
  &lt;/script&gt;
  </code></pre>