[CLOSED] The javascript function in not fire?

  1. #1

    [CLOSED] The javascript function in not fire?

    Hi,

    See the sample i am unable to fire the javascript function(addTab()). See the code.

    Design is
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!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></title>
    
        <script type="text/javascript">
    
            function addTab() {
                alert('hi');
            }
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        
            <ext:ScriptManager ID="scm" runat="server">
            </ext:ScriptManager>
            <ext:ViewPort ID="vw" runat="server">
                <Body>
                    <ext:BorderLayout ID="BorderLayout1" runat="server">
                        <West MinWidth="175" MaxWidth="400" Split="true" Collapsible="true">
                            <ext:Panel ID="WestPanel" runat="server" Title="" Width="175">
                                <Body>
                                    <ext:Accordion ID="Accordion1" runat="server" Animate="true">
                                        <ext:Panel ID="LinkFolders" runat="server" Title="LinkFolders" IconCls="LinkFolder-icon"
                                            Border="false" BodyStyle="padding:6px;">
                                            <Listeners>
                                                <Expand Handler="Coolite.AjaxMethods.OnAccordianExpand1()"></Expand>
                                            </Listeners>
                                            <Body>
                                                <ext:TreePanel ID="TreeLinkFolder" runat="server" BodyBorder="false" UseArrows="True">
                                                </ext:TreePanel>
                                            </Body>
                                        </ext:Panel>
                                    </ext:Accordion>
                                </Body>
                            </ext:Panel>
                        </West>
                        <Center>
                            <ext:Panel ID="pnlContent" runat="server">
                                <Body>
                                </Body>
                            </ext:Panel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
            </ext:ViewPort>
        
    
        </form>
    </body>
    </html>
    code is
    
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    using Coolite.Ext.Web;
    public partial class Default2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Hashtable htLF = new Hashtable();
            htLF.Add(0, "My Addresses");
            htLF.Add(1, "Some Folder");
            htLF.Add(2, "a");
            htLF.Add(3, "dffdsf");
            htLF.Add(4, "For Sai");
            htLF.Add(5, "Link");
            htLF.Add(6, "Link Folder");
            htLF.Add(7, "My links");
            htLF.Add(8, "new link");
            htLF.Add(9, "temp folder");
            htLF.Add(10, "Testttt");
            htLF.Add(11, "xvcx");
    
            Coolite.Ext.Web.TreeNode linkNodes = new Coolite.Ext.Web.TreeNode("LinkFolders");
            for (int i = 0; i < htLF.Count; i++)
            {
                Coolite.Ext.Web.TreeNode linkNode = new Coolite.Ext.Web.TreeNode(htLF[i].ToString());
                linkNodes.Nodes.Add(linkNode);
            }
    
            TreeLinkFolder.Root.Add(linkNodes);
            TreeLinkFolder.RootVisible = false;
        }
        [AjaxMethod]
        public void OnAccordianExpand1()
        {
            scm.AddScript("addTab()");
        }
    }
  2. #2

    RE: [CLOSED] The javascript function in not fire?

    Hi,

    For me it works fine. I see 'hi' message after collapse and expand the panel. Do you have the problem with exactly the same example?
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: [CLOSED] The javascript function in not fire?

    Yes for the same example, we are unable to see (hi) message.We are using .net2008
  4. #4

    RE: [CLOSED] The javascript function in not fire?

    Hi,

    I tested it under VS 2008. Please post test solution with assemblies for testing (create simple solution with that example and add your local assemblies)
    Vladimir Shcheglov
    Sr. Developer
  5. #5

    RE: [CLOSED] The javascript function in not fire?

    hi ,

    I am sending the application.See the attachment.
  6. #6

    RE: [CLOSED] The javascript function in not fire?

    Hi,

    1. web.config. Does't contains required AjaxRequestModule. Please see
    http://forums.ext.net/showthread.php?3809#post15508

    2. Don't forget semicolumn when you register js function calling otherwise if you register additional script then it raise js error
    scm.AddScript("addTab();");
    3.Wrap your Page_Load with
    if(!Ext.IsAjaxRequest()){...}
    It will avoid additinal script generates with is not required during AjaxEvent
    Last edited by geoffrey.mcgill; Jan 11, 2011 at 10:21 PM.
    Vladimir Shcheglov
    Sr. Developer
  7. #7

    RE: [CLOSED] The javascript function in not fire?

    Hi,

    Please send me the whole web.config file for this sample.
  8. #8

    RE: [CLOSED] The javascript function in not fire?

    Hi,

    Please see attachment
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. Replies: 1
    Last Post: Mar 21, 2012, 7:47 PM
  2. [CLOSED] Ext.net.DirectEvent.request don't fire my success function
    By emmanuel.sans.domenech in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 06, 2012, 10:32 AM
  3. [CLOSED] Fire directevent from javascript
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 15, 2011, 5:05 PM
  4. [CLOSED] Ajaxmethod success function won't fire
    By reinout.mechant@imprss.be in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 28, 2009, 3:15 PM
  5. Fire Off Coolite Button from Javascript
    By Juls in forum 1.x Help
    Replies: 6
    Last Post: Apr 13, 2009, 2:32 PM

Posting Permissions