How do you add a resource item

  1. #1

    How do you add a resource item

    I'm loading a ascx control through a tab using autoload.

    In the ascx file, i want to require a bunch of javascript from YUI. Is this possible? Can i add it to the resource manager?

    If so, what would be the syntax?

    Ext.Net.ResourceManager.AddInstanceScript?
    
    Ext.Net.ResourceManager.RegisterControlResources.AddInstanceScript?
    I want to add the following scripts.

    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.2r1/build/assets/skins/sam/skin.css" />
    <script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js&2.8.2r1/build/element/element-min.js&2.8.2r1/build/button/button-min.js&2.8.2r1/build/connection/connection-min.js&2.8.2r1/build/container/container-min.js&2.8.2r1/build/datasource/datasource-min.js&2.8.2r1/build/datatable/datatable-min.js&2.8.2r1/build/tabview/tabview-min.js&2.8.2r1/build/uploader/uploader-min.js"></script>
    I'm hoping to use the resource manager because then hopefully it will wait for those scripts to load. Just putting the above code at the top of ascx control doesn't work.
    Last edited by geoffrey.mcgill; Feb 05, 2011 at 6:41 PM. Reason: please use [CODE] tags
  2. #2
    Hi,

    In future forum posts, please ensure your code samples/snippets are wrapped in [CODE] tags.

    http://forums.ext.net/showthread.php...ing-New-Topics
    Geoffrey McGill
    Founder
  3. #3
    Hi craig2005,

    We can suggest you to create a custom control and override its Resources property.

    Please see the example:
    http://forums.ext.net/showthread.php?7946
  4. #4
    @craig2005 - Please post a simplified code sample demonstrating how you currently have things configured. If you are including a .ascx, please post (in [CODE]) tags, one simplified .aspx and one simplified .ascx.

    Thanks.
    Geoffrey McGill
    Founder
  5. #5
    The custom control is a clever idea. I just don't want to get into a race condition where I'm executing javascript on the page but the custom control hasn't loaded it yet.

    I already have a similar issue with our tabs. I'm loading the calendar control in one of the tabs. If the user clicks the calendar tab before the entire page is loaded, then he will get "Ext is not defined errors"
  6. #6
    Also masking can help in cases that you described, please see
    https://examples1.ext.net/#/Panel/Bo...Standard_Mask/
  7. #7
    If i can specifically control the mask, it might not be so bad. In my experience, masking the entire page can cause issues because external sites like google adsense, woopra, and other stuff like that. We don't want the mask to be dependent on those non critical external resources.

    The example you gave is for auto loading panels. The tabs aren't loading in an auto loading panel. It's just a tab panel on the main page. The content inside those tabs is auto loading and that's where the problem occurs. I pretty much need to disable the tabs until the Ext javascript is loaded by the resource manager... unless you have a better idea.

Similar Threads

  1. Replies: 1
    Last Post: Apr 16, 2013, 3:06 AM
  2. ext.asd resource not found
    By rkchak in forum 1.x Help
    Replies: 2
    Last Post: Mar 26, 2012, 6:19 PM
  3. [CLOSED] Always selected Item is nothing for combobox as menu item
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  4. Icon resource
    By Yannis in forum 1.x Help
    Replies: 1
    Last Post: Jun 22, 2010, 4:02 AM
  5. Replies: 1
    Last Post: Jun 01, 2009, 5:15 PM

Posting Permissions