Search code examples
c#javascriptasp.netjquery-pluginsgeomap

GeoMaps with web user control


I'm trying to use geomap to view the location.. I'm using this code

    function OnLoad() {
        $.ajax({
            type: "POST",
            **url: "CS.aspx/CreateWorldMap"**,
            data: '{}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: DrawWorldMap
        });
    }

where CS.aspx is aspx page and CreateWorldMap is a function inside this page.. Can anyone suggest How can i use usercontrol in the url propety instead of this aspx page.??

bcoz i have to integrate this in an opensource site which only accepts usercontrols not a web page..

Thank you..


Solution

  • In my opinion there exists only one way: Make a static method inside your page code-behind which will call actually UserControl method. So, in user control define

    public void DoSomething()
    {
       // do smth.
    }
    

    in your page create:

       [WebMethod]
       public static void DoSomething()
       {
           UserControl1.DoSomething();
       }
    

    and load it with your code