Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesRegisterStartupScript does not fire after postbackRegisterStartupScript does not fire after postback
Previous
 
Next
New Post
9/24/2012 6:13 PM
 

I have written a module in DNN 6.2 where I need to execute JavaScript code on the client side both on the initial firing and on subsequent postbacks.  This means after the server has presented the page response back to the user (either initially or after a postback response to a search button has been processed by the server.

 I have been working for over 6 hours today trying to get it to work.  Every post I see says that what I am doing should be working, but it is not.

            string sName = "NearMapStartupScript";
            string cstext = string.Format("ProcessPoints('{0}', '{1}');", hdnMapData.ClientID, txtMapData.ClientID);
            ScriptManager.RegisterStartupScript(this, typeof(string), sName, cstext, true);

The result is the ProcessPoints Javascript runs the first time, but it does not fire on any subsequent cases.

 I need a solution to this that actually works for BOTH first time and subsequent postbacks.  Again, this is AFTER the server has done its work and the page is returned to the user.  I want a JavaScript function to fire.

 Thank you so much,

p

 
New Post
9/24/2012 8:29 PM
 

Paul,

I have this working on a DNN 06.01.05 and I think it should be the same for you.

My ascx file just has a button to cause a postback and nothing else. 

Then in the code behind I have a Page_Load and inside the Page_Load I have this line:

ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "AnyKey", " est');", true);

That is all. Alert shows on initial load and on postback.

A couple of things to check for are the parameters you pass to RegisterStartupScript. I see a few differences between our parameters. Also make sure you don't have a if(!IsPostBack) somewhere in your code that might be preventing one of your method calls.

Are you loading a javascript file or is your javascript in the ascx control? 

Another idea is to check the javascript console in your browser for any errors. Maybe the function is getting called but an error occurs.


Hristo Evtimov
www.packflash.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesRegisterStartupScript does not fire after postbackRegisterStartupScript does not fire after postback


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out