I am inside of…
public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) { Some code...
and after ‘some code’ I want to trigger
[WebMethod] public static void DoSome() { }
Which triggers some javascript. Is this possible?
Ok, switch methods here. I was able to call dosome(); which fired but did not trigger the javascript. I have tried to use the registerstartupscript method but don’t fully understand how to implement it. Here’s what I tried:
public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) { ...my C# code to perform on dropdown selection... //now I want to trigger some javascript... // Define the name and type of the client scripts on the page. String csname1 = 'PopupScript'; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; // Check to see if the startup script is already registered. if (!cs.IsStartupScriptRegistered(cstype, csname1)) { String cstext1 = 'alert('Hello World');'; cs.RegisterStartupScript(cstype, csname1, cstext1, true); } }
}
I got the registerstartupscript code from an msdn example. Clearly I am not implementing it correctly. Currently vs says ‘An object reference is required for the non-static field, method, or property ‘System.Web.UI.Page.ClientScript.get’ refering to the piece of code ‘Page.Clientscript;’ Thanks.
I’m not sure I fully understand the sequence of what you are trying to do, what’s client-side and what’s not….
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.
If you add a ScriptManager tag on your page, you can call WebMethods defined in the page via Javascript.
From the Page_Load function you can add a call to your WebMethod..
Callback_Function represents a javascript function that will be executed after the WebMethod is called…
EDIT:
Found this link for Web ADF controls. Is this what you are using??
From that page, it looks like something like this will do a javascript callback.