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 7046641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:40:30+00:00 2026-05-28T02:40:30+00:00

Am unable to understand why Cannot the below javascript code is not called from

  • 0

Am unable to understand why Cannot the below javascript code is not called from code behind

I have a simple javascript block like this

  function callsCox(res) {
    alert(res);
   }

From my code behind :

 ....
 string res="COX23";
 string script = String.Format("callsCox({0})", res);
 this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Cox",script,true);

Am I missing anything? There aren’t any exceptions or errors.

  • 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. Editorial Team
    Editorial Team
    2026-05-28T02:40:30+00:00Added an answer on May 28, 2026 at 2:40 am

    Page.ClientScript.RegisterStartupScript looks OK to me (might have missed something). Things to try

    1. Add apostrophes to the call – it’s coming through as an object. Try as a string

      string script = String.Format(“callsCox(‘{0}’)”, res);

    2. Is the string script Page.ClientScript.RegisterStartupScript being called after an update panel partial postback. That could effect it

    3. I have know functions not been found if they are in the same page. Try moving to an external js file. Don’t asked me why this has resolved issues but it has a couple of times in the past for me.

    4. Just for debug purposes take the function out of the equation all together, Try to get the alert working like this. It will at least isolate the problem if it does work

      this.Page.ClientScript.RegisterStartupScript(this.GetType(), “Cox”,”alert(‘Does this work?’)”,true);

    5. View the source of the page. Is the function even written into the page (or alert from point 4). It should be. If you put a breakpoint on the this.Page.ClientScript.RegisterStartupScript method is it being hit? Seems like it might not be.

    Apologies for not giving you a ‘hey this is the solution’ type of answer. I’ve had stuff like this in the past and I’ve found it a matter of stripping things down until the problem has been isolated. Someone else may be able to spot an immediate problem of course. Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying this code on GNU's C++ compiler and am unable to understand
I am unable to understand this error.This error is not in the class that
I do not have a %CLASSPATH% set up. As I understand, this should not
I honestly do not know what they are called. I have been unable to
I am unable to understand this loop behavior of the javascript. Can someone tell
I have some questions about basic CSS that I was unable to understand or
This might be a dumb question but I'm unable to understand: When we create
I am struggling to understand the 'reduce' call written below in python. I have
I have the following code which throws an exception (detail in code comments below).
I am unable to understand why I can't get a correct ISO-8859-1 charstet from

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.