[CLOSED] Registering resources in Direct Methods/Events

  1. #1

    [CLOSED] Registering resources in Direct Methods/Events

    ResourceManager.RegisterClientScriptInclude has no effect in Direct Methods/Events. However, I still see that Ext.Net components can register their scripts in Direct methods

    Ext.net.ResourceMgr.load([{url:\"/extnet/extnet-data-debug-js/ext.axd?v=30862\"}],
    Now, is that a registered through a call to RegisterScript (which is the only method that works from all RegisterXXX), or I missed something?

    More importantly, components resources are always registered towards the top of the script generated in Direct Methods. However, a call to RegisterScript myself always registers my script at the end. What can I do to register my resources towards the top of script generarted?

    There was earlier a request that RegisterBeforeInitScript and similar methods work the same in Direct calls as they do in GET requests. It was informed that this would be considered. Is there any progress in this regard??
    Last edited by Daniil; Oct 14, 2010 at 12:09 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Now RegisterClientScriptInclude method of ResourceManager works correctly during ajax request.
    Please update from SVN

    Here is my test case

    Page
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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>Ext.Net Example</title>
        
        <script runat="server">
            protected void LoadClick(object sender, DirectEventArgs e)
            {
                ResourceManager.GetInstance().RegisterClientScriptInclude("test", "testjs.js");
                X.Js.Call("testFn");
            }
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Button runat="server" Text="Load">
                <DirectEvents>
                    <Click OnEvent="LoadClick" />
                </DirectEvents>
            </ext:Button>
        </form>
    </body>
    </html>
    testjs.js file
    function testFn(){
        alert("Test done!");
    }
  3. #3
    Thanks for the update vlad. Any comments on this:

    However, a call to RegisterScript myself always registers my script at the end. What can I do to register my scripts towards the top of client-script generarted?

    There was earlier a request that RegisterBeforeInitScript and similar methods work the same in Direct calls as they do in GET requests. It was informed that this would be considered. Is there any progress in this regard??
  4. #4
    Hi,

    What RegisterScript method do you mean? As I know there is now such public method in the toolkit.

    What can I do to register my resources towards the top of script generarted?
    Hmm, RegisterClientScriptInclude methods loads scripts files first before run generated script. Or do you need to register inline script at the begin?
  5. #5
    Hmmm... I should have been more careful. I was referring to AddScript, AddAfterClientInitScript and AddBeforeClientInitScript etc. script registration methods.

    RegisterClientScriptInclude methods loads scripts files first before run generated script. Or do you need to register inline script at the begin?

    I think it should be clear from above clarification regarding what I meant. Using the above mentioned methods, you can place your script at desired points in the GET requests. However, the Before and After methods have no effect in Direct calls, and AddScript always puts your script at the end of the entire client-script generated by Ext.Net. It would be great to have these methods work exactly the same way for Direct calls as they do in GET requests.
  6. #6
    Also, the same methods on ResourceManager should also put the script at the specified point for Direct calls as it does for GET requests,
  7. #7
    Hi,

    AddAfterClientInitScript and AddBeforeClientInitScript adds the script before/after control creation script. Therefore if control is rendered already then before/after scripts are not used anymore (for example, if you render a control during direct event then you will see before/after script).

    Can you provide server code and expected generated script?
  8. #8
    Quote Originally Posted by Vladimir View Post
    AddAfterClientInitScript and AddBeforeClientInitScript adds the script before/after control creation script. Therefore if control is rendered already then before/after scripts are not used anymore (for example, if you render a control during direct event then you will see before/after script).

    Can you provide server code and expected generated script?
    I think I missed something. I am sure it was happening before, but I am no longer able to reproduce this. AddAfter and AddBefore client init script methods seem to be working fine now in Direct calls too.

    But the same methods on the ResourceManager do not have any effect. Please see the attached code. It would be great if these methods add script at the beginning and end of the scrip generated in Direct calls.
    Attached Files
  9. #9
    Hi,

    Please update from SVN and use RegisterBeforeClientInitScript/RegisterAfterClientInitScript methods of ResourceManager
  10. #10
    Quote Originally Posted by Vladimir View Post
    Please update from SVN and use RegisterBeforeClientInitScript/RegisterAfterClientInitScript methods of ResourceManager
    Too good...
    You people really keep your users happy and delighted...

Similar Threads

  1. Direct Methods and Custom Control
    By Zdenek in forum 1.x Help
    Replies: 0
    Last Post: Apr 19, 2012, 10:18 PM
  2. Replies: 6
    Last Post: Nov 30, 2011, 6:48 PM
  3. [CLOSED] Common Direct Methods
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 25, 2011, 5:54 AM
  4. Are direct methods same as WebMethod
    By deeptechtons in forum 1.x Help
    Replies: 2
    Last Post: Dec 27, 2010, 3:31 AM
  5. [CLOSED] how to pass combobox values through direct methods
    By dev in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Sep 08, 2010, 3:54 AM

Tags for this Thread

Posting Permissions