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

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Avoid PID-files, crons, or anything else that tries to evaluate… May 11, 2026 at 12:20 pm
  • added an answer I have to say I'm really confused about why you're… May 11, 2026 at 12:20 pm
  • added an answer I've figured it out thanks to this post ... SET… May 11, 2026 at 12:20 pm

Related Questions

I am inside of... public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) {
I am trying to install an app inside of another web app. I have
I am trying to declare and use a class B inside of a class
I have some legacy VB6, which I am hosting inside an ActiveX control, which

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.