RadDock and IScriptControl

7 posts, 0 answers
  1. nechmads
    nechmads avatar
    6 posts
    Member since:
    Aug 2007

    Posted 03 Sep 2007 Link to this post

    Hi.
    We are developing a custom portal application.
    I created a class called BaseWidget that inherit from RadDock. The purpose is to provide all the basic widget capabilities in one class (as we have a few different kinds of widgets). For example to add to all widgets the same toolbar, title bar, etc...

    As all our application is fully AJAX based, our widgets also inherits from IScriptControl in order to attach to it some client side capabilities.

    I noticed that if my widget class (that inherits from RadDock) also inherits from IScriptControl, the drag and drop capability of the RadDock stops working completely.

    Is there any way to use RadDock and IScriptControl?
  2. Petya
    Admin
    Petya avatar
    869 posts

    Posted 04 Sep 2007 Link to this post

    Hello nechmads,

    RadDock already implements IScriptControl so you could simply override GetScriptDescriptors() and GetScriptReferences() methods to achieve the desired functionality. Hope this helps.

    Sincerely yours,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. paulo.galão
    paulo.galão avatar
    11 posts
    Member since:
    Aug 2007

    Posted 04 Sep 2007 Link to this post

    Hi there Petya,

    It might seem silly but... can you provide an example where a class that derives from RadDock overrides IScriptControl methods and attaches some client side script to the control?

    Thanks,
    Paulo 
  5. nechmads
    nechmads avatar
    6 posts
    Member since:
    Aug 2007

    Posted 05 Sep 2007 Link to this post

    Hi Petya.
    You right. RadDock already implements IScriptControl, but it marks the methods as private and not protected!
    This means I can't override it in my own class (and I cant call them, the base emthods, in order to let RadDock keep it's functionality).
  6. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Sep 2007 Link to this post

    Hello nechmads,

    You are right, RadDock (and all other Prometheus controls) do not provide a way to override IScriptControl.GetScriptDescriptors(). I added a new protected virtual GetScriptDescriptors() in the RadDock base class. Please, find attached the latest build of RadDock Prometheus which contains the new method.

    Greetings,
    Valeri Hristov (Senior Developer, MCSD)
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. nechmads
    nechmads avatar
    6 posts
    Member since:
    Aug 2007

    Posted 05 Sep 2007 Link to this post

    Thanks Valeri for the quick response.
    I used the hot fix you sent and I'm able to ovveride the methods. But...

    My problem now is that when I use the $find method to get the instance of my control on the client, I get all the functionality that you provide but not the methods that I provided in my script.

    My question is: How can I add more client side functionality?
    Should my client side class inherit from your RadDock client class (if do what is it?)

    the code I used to override your methods is:

     

    protected override System.Collections.Generic.IEnumerable<ScriptDescriptor> GetScriptDescriptors()  
            {  
                System.Collections.Generic.IEnumerable < ScriptDescriptor > baseCollection = base.GetScriptDescriptors();  
     
                ScriptControlDescriptor descriptor = new ScriptControlDescriptor("custom.MyRadDock"this.ID);  
                descriptor.AddProperty("myCustomProp""hello world");  
     
                System.Collections.Generic.List<ScriptDescriptor> myCollection = new System.Collections.Generic.List<ScriptDescriptor>();  
                myCollection.Add(descriptor);  
     
                myCollection.AddRange(baseCollection);  
     
                return myCollection.ToArray();  
            }  
     
     
            protected override System.Collections.Generic.IEnumerable<ScriptReference> GetScriptReferences()  
            {  
                ScriptReference reference = new ScriptReference();  
                reference.Path = ResolveClientUrl("~/Scripts/MyRadDock.js");  
     
                System.Collections.Generic.IEnumerable < ScriptReference > baseCollection = base.GetScriptReferences();  
     
                System.Collections.Generic.List<ScriptReference> myCollections = new System.Collections.Generic.List<ScriptReference>();  
     
                myCollections.Add(reference);  
     
                myCollections.AddRange(baseCollection);  
                              
                return myCollections.ToArray();  
            } 
  8. Petya
    Admin
    Petya avatar
    869 posts

    Posted 10 Sep 2007 Link to this post

    Hello nechmads,

    In your MyRadDock.js file you can enhance the current client-side API using the following approach:

    Telerik.Web.UI.RadDock.prototype.set_Size = function(width, height)
        {
            this.get_element().style.width = width;
            this.set_Width(width);
            this._setCommandsContainerWidth();
           
            this.get_element().style.height = height;
            this.set_Height(height);
            this._setContentContainerHeight(true);
           
            this.updateClientState();
        }

    This is an example of adding a set_Size function to RadDock's client-side API. In case you need further assistance, just let us know.

    Best wishes,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017