Execute JavaScript via Server-Side during TreeView's OnDemand Load

1 reply. Last post: October 22, 2009 5:13 AM by Handy Surya
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Shawn AugustMember

I have a JavaScript that is loaded using LoadOnDemand. The node's children are automatically checked if their parent is checked. This is done by handling the TreeView's OnInitializeNode event as seen below:

        /// <summary>
        /// Handles the Portfolio's TreeView's OnInitializeNode event
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event arguments</param>
        protected void treePortfolioNav_OnInitializeNode(object sender, WebTreeViewNodeEventArgs e)
        {
            // Check the node if the parent is checked
            if (e.Node != null)
            {
                if (e.Node.ParentNode != null && e.Node.ParentNode.Checked == true) 
                { 
                    e.Node.Checked = true;
                    string jsCode = Endurance.Web.Helper.GetJSCode(string.Format("treePortfolioNav_NodeCheckChanged('{0}', null);", "treePortfolioNav"));
//                    System.Web.UI.ScriptManager.RegisterStartupScript(this.treePortfolioNav, this.treePortfolioNav.GetType(), string.Format("{0}treePortfolioNav_NodeCheckChanged{1}", this.ClientID, Endurance.Web.Helper.GetRandomNumber()), jsCode, true);

                }
            }
        }

The problem is that the script never executes probably because the TreeView is performing an AJAX request. How do I get the JavaScript to execute?

All times are GMT -5. The time now is 7:58 AM.
Previous Next