[FIXED] [V0.5] RegisterClientOnReadyInitBlock causes error

  1. #1

    [FIXED] [V0.5] RegisterClientOnReadyInitBlock causes error

    Hello, I wanted to convert ASP.NET dropdownlist to ExtJS combo using JS code from ExtJS examples (http://extjs.com/deploy/dev/examples/form/combos.html) (I use hidden field, because I cannot pass DropDownList to RegisterClientOnReadyInitBlock method as 1st parameter). This code is in Page_Load method:
    ScriptManager1.RegisterClientOnReadyInitBlock(HiddenField1, "DropDownList1-OnReady", 
        @"var converted = new Ext.form.ComboBox({ 
            typeAhead: true, 
            triggerAction: 'all', 
            transform:'DropDown1', 
            width:135, 
            forceSelection:true });");
    and following code is rendered
    <script type="text/javascript">
    //<![CDATA[
    Ext.BLANK_IMAGE_URL='/WebSite1/cool/extjs/resources/images/default/s/gif/cool.axd';Ext.onReady(function(){Ext.QuickTips.init();var converted = new Ext.form.ComboBox({
     typeAhead: true,
     triggerAction: 'all',
     transform:'state',
     width:135,
     forceSelection:true
     });
     // furthercode ...
    this.HiddenField1=new Ext.form.Hidden ({applyTo:"HiddenField1_TextBox",id:"HiddenField1"});});
    </script>
     <!-- Coolite ASP.NET Web Controls [Community Edition]. Version 0.4.1.42666. "Default" Theme. -->
     <link rel="stylesheet" type="text/css" href="/WebSite1/cool/extjs/resources/css/ext-all-embedded/css/cool.axd" />
     <script type="text/javascript" src="/WebSite1/cool/extjs/adapter/ext/ext-base/js/cool.axd"></script>
     <script type="text/javascript" src="/WebSite1/cool/extjs/ext-all/js/cool.axd"></script>
    which causes error, because Ext is referenced before script libraries are loaded. Without registration everything works fine. I tried to move ScriptManager tag up and down the page, but it didn't help.
    When I paste the rendered HTML to static HTML page and swapped the script tags, it worked (i.e. both scripts cool.axd first and then Ext.onReady)
    Thanks for your help.
  2. #2

    RE: [FIXED] RegisterClientOnReadyInitBlock causes error

    Please use ScriptContainer in page header

    (see post for help http://forums.ext.net/showthread.php...d=203-4-1.aspx)
  3. #3

    RE: [FIXED] RegisterClientOnReadyInitBlock causes error

    That doesn't help (see attachment). I need to execute my script inside Ext.onReady function. It renders ok, but in wrong order.
  4. #4

    RE: [FIXED] RegisterClientOnReadyInitBlock causes error



    Hi Karel,


    It's probably best to just place your script inline in the <head> after a ScriptContainer control.


    Example


    <head runat="server">
        <ext:ScriptContainer ID="ScriptContainer1" runat="server" />
        <script type="text/javascript">
            Ext.onReady(function(){
                var converted = new Ext.form.ComboBox({
                    typeAhead: true,
                    triggerAction: 'all',
                    transform:'DropDown1',
                    width:135,
                    forceSelection:true 
                });
            });
        </script>
    </head>

    There's still some work to be done to the RegisterClientOnReadyInitBlock, although eventually you will be able to add to the OnReadyInitBlock from code-behind.


    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5

    RE: [FIXED] RegisterClientOnReadyInitBlock causes error

    Thank you very much, that worked!

Similar Threads

  1. Replies: 4
    Last Post: Apr 16, 2011, 6:33 PM
  2. [FIXED] [V0.8] TabFx Error
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Apr 02, 2009, 10:02 AM
  3. [FIXED] [V0.8.0] desktop js error
    By [WP]joju in forum Bugs
    Replies: 20
    Last Post: Mar 17, 2009, 1:46 AM
  4. [FIXED] [V0.8.0] gridpanel error
    By [WP]joju in forum Bugs
    Replies: 2
    Last Post: Jan 06, 2009, 4:56 AM
  5. [FIXED] [V0.6] JavaScript error
    By Timothy in forum Bugs
    Replies: 1
    Last Post: Aug 28, 2008, 11:43 AM

Posting Permissions