Cannot invoke a method in Js while loading second time

asp.net , xml Madrid, Spain
  • 9 years ago
    We have many transactions for eg:CashDeposit that are defined in xml eg:CashDeposit.xml.
    That XML is converted in to controls and placed in an usercontrol.
    While loading each Transaction we are loading an js file dynamically eg:CashDeposit.js for CashDeposit.
     
    This is the code for loading the Js file dynamically:
     
               string txnJS = "../ClientScripts/" + SessionManager.CurrentTransName + ".js";
                ScriptReference dynamicJS = new ScriptReference(txnJS);
                scrMain.Scripts.Add(dynamicJS);//scrMain is asp:ScriptManagerProxy
     
    then a method called ChkLoadBody() in the currentTransaction.js for eg:CashDeposit.js is invoked from the codebehind as:
     
               this.Page.ClientScript.RegisterStartupScript(Page.GetType(), "OnLoad",
                      "ChkLoadBody()", true);
    In this method we move some fields dynamically.
     
    The issue is while performing the transaction at first time we are able to load the transaction.js and we can able to invoke the ChkLoadBody() from js.
    But after performing the same transaction,when we try to execute the same at second time we cant able to invoke the ChkLoadBody() from js.
    how to resolve this issue?

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programs must be written for people to read, and only incidentally for machines to execute.”