[CLOSED] Custom Controls & resources. Creating at client side.

  1. #1

    [CLOSED] Custom Controls & resources. Creating at client side.

    Hi,
    I created a lot of my own controls, inherited from various Ext.Net controls...
    Most of those controls use js/css resources, registered by overriding List<ResourceItem> Resources { get; }.
    All works fine while I create my controls via builders in *.cshtml.

    The problem comes then I try create my control dynamically at client side - no embedded resources registered. So JS-code ext.Create('MyOwnControl') fail.

    Is the any correct way to register control resources without creating an instance of control at server side?

    It would be nice to have a method like this:
    @ext.ResourceManager().RequiredControl(typeof(MyOw nControl))

    Any suggestion are welcome)
    Last edited by fabricio.murta; Dec 23, 2015 at 7:56 PM. Reason: [CLOSED]
  2. #2
    Hi @alex303,

    Please use ResourceManager.RegisterControlResources<MyControl>();.

    Here is a full example with a SelectBox which has an individual JavaScript file since it is an UX. Please notice that a call should be after the ResourceManager definition.

    <!DOCTYPE html>
    <html>
    <head>
        <title>Ext.Net.MVC v2 Example</title>
    </head>
    <body>
        @Html.X().ResourceManager()
    
        @{
            ResourceManager.RegisterControlResources<SelectBox>();
        }
    </body>
    </html>
    Last edited by Daniil; Dec 23, 2015 at 8:08 PM.
  3. #3
    My bad... I was looking for such method in sources attentively, and didnt find it.
    Anyway thanks a lot, Daniil!

Similar Threads

  1. Creating Razor helper methods for custom controls
    By Daniil in forum Examples and Extras
    Replies: 7
    Last Post: Apr 28, 2016, 7:29 PM
  2. [CLOSED] Creating custom control on server side
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Feb 21, 2012, 10:15 AM
  3. [CLOSED] Best practive for creating custom/composite controls
    By anup in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 04, 2011, 11:47 AM
  4. Replies: 6
    Last Post: Sep 01, 2009, 1:06 PM
  5. Replies: 2
    Last Post: Mar 08, 2009, 10:11 AM

Posting Permissions