Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not sure I fully understand the sequence of what you are trying to do, what's client-side and what's not....</p> <p>However, you could add a Start-up javascript method to the page which would then call the WebMethod. When calling a WebMethod via javascript, you can add a call-back function, which would then be called when the WebMethod returns.</p> <p>If you add a ScriptManager tag on your page, you can call WebMethods defined in the page via Javascript. </p> <pre><code>&lt;asp:ScriptManager ID="scriptManager1" runat="server" EnablePageMethods="true" /&gt; </code></pre> <p>From the Page_Load function you can add a call to your WebMethod..</p> <pre><code>Page.ClientScript.RegisterStartupScript( this.GetType(), "callDoSome", "PageMethods.DoSome(Callback_Function, null)", true); </code></pre> <p>Callback_Function represents a javascript function that will be executed after the WebMethod is called... </p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function Callback_Function(result, context) { alert('WebMethod was called'); } &lt;/script&gt; </code></pre> <p><b>EDIT:</b></p> <p>Found this link for <a href="http://edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/ADF/custom_tools_commands.htm" rel="nofollow noreferrer">Web ADF controls</a>. Is this what you are using??</p> <p>From that page, it looks like something like this will do a javascript callback.</p> <pre><code>public void ServerAction(ToolbarItemInfo info) { string jsfunction = "alert('Hello');"; Map mapctrl = (Map)info.BuddyControls[0]; CallbackResult cr = new CallbackResult(null, null, "javascript", jsfunction); mapctrl.CallbackResults.Add(cr); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload