[CLOSED] My own resources with id

  1. #1

    [CLOSED] My own resources with id

    Hi,

    I'm using ScriptManager to register my own embedded js files.
    Taking a look in the page code I see the Ext.Net register script at head tag and define the own ID (39452).

    <script type="text/javascript" src="/extjs/adapter/ext/ext-base-js/ext.axd?v=39452"></script>
    The scriptmanager class works fine for me. But I want to know the trick, how can I do that?

    That?s the tag generated by my ScriptManager, and inside tag body.

    <script src="/ScriptResource.axd?d=p_ZpvK7jQSlar_nGnhq_UwGi2WgQBUjRR5KweiH2TBOLo2RfkQt8kqni2lx-TDQJ_1DHqp0OTgAmonvuOSjphd13ebvnAx-Pf2zYFW4DJ2gUwWPHm2V0gAsEmXpmtw9gzyS3Tg2&amp;t=ffffffff9fd2dc92" type="text/javascript"></script>
    So, how can I define my own link resource like you do in ext? (/ext.axd?v=39452) and generate on tag head?

    Thanks. :)
    Last edited by Daniil; Oct 18, 2011 at 1:53 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Well, our resource handler can't suite your needs, because it can register resources from Ext.Net.dll only.

    To know how our resource handler works I'd recommend to look into its sources RecourceHandler.cs.
  3. #3
    Hi,
    I took a look at ResourceHandler.cs and start to create my own class.
    I know about handlers/modules, I put the declaration on web.config file to call handler to my js files.
    But, I really don't know what I'm doing wrong.

    I know, that's not about Ext.Net, but I'll appreciate if someone can help me with this problem.

    Here is a simple code that I'm developing to get started with this. Please, if you could take a look and telling me what I'm doing wrong, some tips, a north... I'll appreciate.

    http://desenvolvedores.net/ext.net/E...JavaScript.zip

    []'s
  4. #4
    Please provide more details about the issue.

    Are you trying to achieve registering resources of your custom control the same way like it's done in Ext.Net?

    And where did you stop? Any errors, exceptions?
  5. #5
    Quote Originally Posted by Daniil View Post
    Are you trying to achieve registering resources of your custom control the same way like it's done in Ext.Net?
    Yes, I'm started with js files, but the idea it's to expand to another files type, css, images .. etc..

    Quote Originally Posted by Daniil View Post
    And where did you stop? Any errors, exceptions?
    That's the problem... nothing happens, no error, excpetions, messages, nothing...

    Using the fiddler, i got this:


    GET http://localhost:3139/erp.axd?r=EmbeddingJavaScriptMyControl.resources.js.MyControl.js HTTP/1.1
    Accept: application/javascript, */*;q=0.8
    Referer: http://localhost:3139/Default.aspx
    Accept-Language: pt-BR
    User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
    Accept-Encoding: gzip, deflate
    Host: localhost:3139
    Connection: Keep-Alive
    and

    HTTP/1.1 200 OK
    Server: ASP.NET Development Server/9.0.0.0
    Date: Tue, 18 Oct 2011 12:38:54 GMT
    X-AspNet-Version: 2.0.50727
    Cache-Control: private, must-revalidate, max-age=2592000
    Expires: Wed, 17 Oct 2012 12:38:54 GMT
    Last-Modified: Tue, 18 Oct 2011 12:38:47 GMT
    Content-Type: text/javascript; charset=utf-8
    Content-Length: 76
    Connection: Close
    
    MyControl = new Object();MyControl.Alert = function(m){debugger;alert(m);}
    As we can see, my script was generated

    MyControl = new Object();MyControl.Alert = function(m){debugger;alert(m);}
    but, nothing happens :(
  6. #6
    Please clarify what are you expecting from that code:
    MyControl = new Object();MyControl.Alert = function(m){debugger;alert(m);}
    I think it should do nothing as it is, but you can call:
    MyControl.Alert();
  7. #7
    Hi,
    I found my error...
    My class it's ok, everything's ok... just one thing is not ok...
    I ended the script tag with this /> not </script>

    changing this line
    <script type="text/javascript" src="erp.axd?r=EmbeddingJavaScriptMyControl.resources.js.MyControl.js" />
    to this

    <script type="text/javascript" src="erp.axd?r=EmbeddingJavaScriptMyControl.resources.js.MyControl.js"></script>
    works fine.

    I´m ashamed of myself ... lol... thanks for you help and patience .. and I really sorry to taking your time with this
  8. #8
    Quote Originally Posted by Daniil View Post
    Please clarify what are you expecting from that code:
    MyControl = new Object();MyControl.Alert = function(m){debugger;alert(m);}
    I think it should do nothing as it is, but you can call:
    MyControl.Alert();
    I call this code on prerender

     protected override void OnPreRender(EventArgs e)
            {
                base.OnPreRender(e);
                if (ShowMessage)
                {
                    string script = string.Format("MyXControl.Alert('Olá. Eu sou um MyControl e meu nome é: {0}');", ClientID);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), ClientID, script, true);
                }
            }
    the property ShowMessage is true

    Thanks a lot :)
  9. #9
    No problem, please feel free to ask.

    Anyone of us learns something every day as well:)

Similar Threads

  1. [CLOSED] New Culture Resources
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 04, 2012, 2:02 PM
  2. [CLOSED] get png the Ext Resources
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 29, 2012, 7:23 PM
  3. [CLOSED] CSS Resources - Photoshop ?
    By sisa in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 06, 2011, 12:25 PM
  4. [CLOSED] [MVC] Extend EXT Resources
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 29, 2010, 1:32 PM
  5. Replies: 2
    Last Post: May 12, 2010, 12:34 PM

Posting Permissions