Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 53877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:07:56+00:00 2026-05-10T17:07:56+00:00

I am inside of… public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) {

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:07:56+00:00Added an answer on May 10, 2026 at 5:07 pm

    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.

    <asp:ScriptManager ID='scriptManager1'      runat='server' EnablePageMethods='true' /> 

    From the Page_Load function you can add a call to your WebMethod..

    Page.ClientScript.RegisterStartupScript(     this.GetType(),      'callDoSome',     'PageMethods.DoSome(Callback_Function, null)',      true); 

    Callback_Function represents a javascript function that will be executed after the WebMethod is called…

    <script language='javascript' type='text/javascript'>     function Callback_Function(result, context) {         alert('WebMethod was called');     } </script> 

    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.

    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); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
Inside Magento templating code I want to get the width and height of the
Inside of the onReceive(Content context, Intent intent) method of my public class MediaButtonIntentReceiver extends
Inside class, I would like to define some const strings.however the compiler reports error
Inside Myclass.h Class Myclass { public: Myclass(); private: static int Myarray[12]; }; How to
Inside the Person Class: public Point[] endPointArray; private int scalar; private Head head; private
Inside my Controller i have function that runs after user clicks on item, which
Inside Controller I need to get a rendered string and do some actions with
Inside my code I am typecasting a variable before I return it (C++). Is
Inside an initialization method, I have the following code - (id)init { self =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.