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

  • Home
  • SEARCH
  • 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 6774951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:50:56+00:00 2026-05-26T15:50:56+00:00

I have a client script on a page, that calls a dynamic script generated

  • 0

I have a client script on a page, that calls a dynamic script generated by a user control using ClientScript.RegisterStartupScript. The user controls script is dynamic, the pages’ static.

The issue I have, is the page client script cant find the function rendered by the user control. The method signatures match, everything is good.

However, the user controls script is contained on the page after the static script. Would this make a difference? If so, is there a way to render the script before the static script – according to the MSDN api docs the only way is to combine all scripts into one.

I don’t have the luxury of doing this because the dynamic script uses the ClientID of the user control to uniquely identify itself – there is more than one occurrence of the user control.

Is there an easy way around this?

Cheers

  • 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-26T15:50:57+00:00Added an answer on May 26, 2026 at 3:50 pm

    My advise is that you make this “dynamic” script a static one that takes the control(s) id(s) as parameter. For example you could have something like:

    function MyFunction(dynamicElementID)
    {
        var myelement  =document.getElementById(dynamicElementID);
        //do something with myelement... 
    }
    

    And then on your code-behind, you can call this script as so:

    ClientScript.RegisterStartupScript(this.GetType(),"myscript","MyFunction('"+control.ClientID+"');");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom validator that points to a Client side script to validate
I'm using AJAX.NET including update panels, web service calls, client controls etc. In may
I have implemented an "unsaved changes" warning using techniques described on these pages: Client/JS
I have a page that when the user clicks a button there is a
I have this piece of code: Page.ClientScript.RegisterClientScriptInclude(this.GetType(), Guid.NewGuid().ToString(), this.ResolveUrl(~/Scripts/min.js)); When we push to our
I have client application that uses WCF service to insert some data to backend
We have client server based app which saves user related data into a zip
I have a php script which sends user a mail if his purchase is
I have another script that I can't figure out what is wrong with it.
What's the best way to implement user controls that require AJAX callbacks? I want

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.