Custom Command Question

7 posts, 0 answers
  1. Ron Trichel
    Ron Trichel avatar
    3 posts
    Member since:
    Sep 2005

    Posted 12 Jul 2007 Link to this post

    Maybe I missed it somewhere but how do I/can I set the image of a custom command.  When I've tried to add one to a RadDock all I can get to show up is the "gear" looking circle.  For example, I would like to add a custom command for help.  I would like this to show an image of a question mark "?".

    Also when I add the commands using the following code from an example I found somewhere:

     DockCommand command = new DockCommand();
     command.AutoPostBack = true;
     command.Name = "Command1";        
     dock.Commands.Add(command);
           
    I lose the Minimize command that is there by default. I do have my RadDock's DefaultCommand set to ExpandCollapse.

    Thanks!
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 13 Jul 2007 Link to this post


    Hi Ron,

    1) To change the icon of the custom command you need to define a CSS style on your page and then set the CssClass property of your custom command. Something like this:
    .MyCustomStyle
    {
        width:15px;
        background:url(images/custom.gif) no-repeat;   
    }
    ...
    DockCommand command = new DockCommand();
    command.CssClass = "MyCustomStyle";
    RadDock1.Commands.Add(command);


    The DockToggleCommand has two properties: CssClass and AlternateCssClass for the two states of the command item.

    2) By default RadDock will automatically add command items in its Commands collection, if its value was not changed, depending on the value of the DefaultCommands property. When you add a command item in the code behind, or in the ASPX/ASCX, RadDock will not create the default command items. You need to add them explicitly:
    DockCommand command = new DockCommand();
    command.CssClass = "MyCustomStyle";
    RadDock1.Commands.Add(command);
    RadDock1.Commands.Add(new DockCloseCommand());
    RadDock1.Commands.Add(new DockExpandCollapseCommand());
    RadDock1.Commands.Add(new DockPinUnpinCommand());



    Best Regards,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Ron Trichel
    Ron Trichel avatar
    3 posts
    Member since:
    Sep 2005

    Posted 13 Jul 2007 Link to this post

    That did it...

    Thanks!
  4. Geert-Jan
    Geert-Jan avatar
    1 posts
    Member since:
    Jan 2009

    Posted 15 May 2009 Link to this post

    Got the latest version Q1 2009 SP1.

    This doesn't work. For every custom command I add a style I get the collapse icon. I'm using IE8.
  5. Obi-Wan Kenobi
    Obi-Wan Kenobi  avatar
    460 posts
    Member since:
    Aug 2007

    Posted 18 May 2009 Link to this post

    You should override the default styles- set !important, e.g.
    .MyCustomStyle
    {
        width:15px !important;
        background:url(images/custom.gif) no-repeat !important;   
    }
  6. Wayne
    Wayne avatar
    2 posts
    Member since:
    Jun 2009

    Posted 17 Jun 2009 Link to this post

    I am having this same issue.  I have added the !important tags to my styles (see below)

    .deleteCommand  
        width:15px !important; 
        background:url(images/1_5/basic_set/delete_16.png) no-repeat !important; 

    Before I added the important tag all of my images had changed from gears to the expand/collapse icon.  Once I added the important tag all of the images went away completely and the new ones are still not showing up.  I also tried changing the width to 16px since that is the size of my image but it didn't help.

    Here is the code I am using to create the command:

            DockCommand rdocDelete = new DockCommand(); 
            rdocDelete.Name = "del@@@" + KPI_ID + "@@@" + CUBENAME; 
            rdocDelete.CssClass = "deleteCommand"
            rdocDelete.OnClientCommand = "DeleteKPI"
            rdocDelete.Text = "CLICK HERE TO DELETE THIS KPI VIEW."
            dockableObject.Commands.Add(rdocDelete); 

    Thanks in advance for your help!

    Wayne
  7. Petko
    Admin
    Petko avatar
    45 posts

    Posted 19 Jun 2009 Link to this post

    Hello Wayne,

    Everything in you code looks fine. May I ask you to open the support ticket and send us running project, where we can observe the problem? Once we receive it, we'll do our best to help you.

    Greetings,
    Petko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top