1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to use CommandPanel control

How to use CommandPanel control

7 posts, 0 answered
  1. Developer
    Developer avatar
    10 posts
    Registered:
    02 Aug 2007
    16 Aug 2007
    Link to this post
    Hi Everyone (again),
        I have the file commandPanel.cs and I have defined some buttons which control the controlPanel to show different modes.
       I saw that in the sample contact ,they use Visible property to control  which should be shown. I have about 20 modes. and I want to have each one when clicked to change the controlPanel.
    My question is how to make  these buttons work  in the commandPanel?

    Thanks :)

    BTW please excuse my English as I am Chinese and English is my second language.
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    16 Aug 2007
    Link to this post
    Hello Developer,

    Please take a look at this blog post I have written on our blog.
    http://blogs.sitefinity.com/Ivan/Post/07-08-14/improvements_in_modules_architecture_in_sitefinity_sp2.aspx
    It explains exactly how you can easily communicate beteween CommandPanel and ControlPanel and vice versa.

    So, after you modify your CommandPanel and ControlPanel according to the post (it's very simple, it'll take you maybe few minutes), you can change the mode property of your ControlPanel from CommandPanel (this.ControlPanel.Mode = ...) and then refresh the ControlPanel (this.ControlPanel.Refresh()).

    Kind regards,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Developer
    Developer avatar
    10 posts
    Registered:
    02 Aug 2007
    20 Aug 2007
    Link to this post
    Hi, Ivan
        Thanks for your response.
        But  I cannot find the "Telerik.Web.ControlPanelBase" and "Telerik.Web.CommandPanelBase".
    I have referenced the "Telerik.Framework" which version was 3.0.1323.1.
    Did I miss something?

     Thanks :)

  4. Developer
    Developer avatar
    10 posts
    Registered:
    02 Aug 2007
    20 Aug 2007
    Link to this post
    Thanks .
    I have find these classes.
    :P
  5. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    20 Aug 2007
    Link to this post
    Hello Developer,

    As I can see from your earlier post, you have tried the sample module provided at Sitefinity blogs. When you work with it, please add a new class to that module (in this case add it to Sample.Contacts) and add "using Telerik.Framework" in the class. Then, when you type in "telerik.web.",  you should be able to see the two classes among those that appear as options using IntelliSense. Also, make sure you have added Telerik.Framework as reference. If the Sample.Contacts module works, then you  should do the same for your project. If it doesn't, please send your project so that we could take a look at it.

    Kind regards,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Developer
    Developer avatar
    10 posts
    Registered:
    02 Aug 2007
    20 Aug 2007
    Link to this post
    Hi,
     Thanks for your help.
    It can work now, but we also have some questions about  how to use these class.
    In the Sample.Contract, It used the visible property to show or hide the contractEditor. But we have a lot of controls, It hard to switch them use this way.

    If we have two links eg: product, voucher
    and two controls, productControl, voucherControl.
    How to deal with them? I mean click product will be show the productcontrol,
    and click voucher link will be shown the voucherControl.

    Could you give us some suggestion ? If you could provide us some examples that will be great.
    Cheers :)
  7. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    21 Aug 2007
    Link to this post
    Hello Developer,

    it is quite common as you have stated, that you have many different "screens" or view modes in your ControlPanel, so a good approach would be to create an enumeration in your Control Panel that would contain all the possible modes, something like :
    public enum ControlPanelModes
    {
         ProductList,
         ProductInsert,
         ProductEdit,
         VoucherList,
         VoucherInsert,
         VoucherEdit
    }
    The next thing you would generally do is create a public property in Control Panel, something like :

    public ControlPanelModes CurrentMode
    {
           get { ... };
           set { ... };
    }
    Then, you could from Command Panel simply change the current mode of Control Panel and call the Refresh() method. Obviously, in your Control Panel class, you would need to provide the logic that would display correct controls based on the current mode, but you have to do that one way or another.

    I hope this helps.

    All the best,
    Ivan
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
7 posts, 0 answered