[CLOSED] Execute javascript from Masterpage child

  1. #1

    [CLOSED] Execute javascript from Masterpage child

    I need to execute js from an ajax postback that was initiated from an ext:TaskManager. The task manager and js code are all on the child page but the Ext:ResourceManager resides on the Masterpage. Any help would be appreciated, thanks!
    Last edited by Daniil; Aug 10, 2010 at 5:35 PM.
  2. #2
    Hello, tjbishop!

    You can use method AddScript of X class.

    Master page
    <%@ Master Language="C#"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
    Content page:
    <%@ Page Title="" Language="C#" MasterPageFile="~/Premium help/_Work.Master" %>
    <script runat="server">
        protected void Update_Handler(object sender, DirectEventArgs e)
            X.AddScript("Ext.Msg.alert('Server Update', 'Hello from server! Here is your js code!')");
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:TaskManager ID="TaskManager1" runat="server">
                <ext:Task TaskID="testTask" AutoRun="false">
                        <Update OnEvent="Update_Handler" Success="#{TaskManager1}.stopTask('testTask');"/>
        <ext:Button runat="server" Text="Start Task">
                <Click Handler="#{TaskManager1}.startTask('testTask');" />
  3. #3


    Perfect, thanks!
  4. #4
    You can also use the .Call() Method to call a specific JavaScript client-side function by name.


    The "doSomething" function would be defined in the client-side JavaScript.


    var doSomething = function () {
        // do...
    By the way, you can also fire a client-side alert with the following.


    X.Js.Alert("Hello World");
    Hope this helps.
    Geoffrey McGill

Similar Threads

  1. [CLOSED] Calling a Javascript function of Child page from Popup (inside Frame)
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 27, 2011, 6:00 AM
  2. [CLOSED] Dynamic usercontrol and execute javascript
    By Patman in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 30, 2011, 4:50 PM
  3. [CLOSED] Unselect child nodes of an AsyncTreeNode in javascript
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 23, 2010, 6:03 PM
  4. [CLOSED] How to call a javascript function from a child page?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 25, 2010, 5:40 PM
  5. Replies: 1
    Last Post: Sep 04, 2009, 12:26 PM

Posting Permissions