JavaScript to disable a RadPanelItem and all its control

6 posts, 0 answers
  1. manu
    manu avatar
    4 posts
    Member since:
    Apr 2009

    Posted 15 Apr 2009 Link to this post

    Hi:
    I have a RadPanelBar with a several RadPanelItem inside of it.

    To disable or enable a panelItem on the server side I use the following code

     (this.RadPanelBar1.Items[i] as RadPanelItem).Enabled= enable
    where "i" is the panel that I want to disable. With this the panel and all its controls are disabled.

    But I haven't found a javascript that make the same. I've tried with this code:
     var panel=$find('RadPanelBar1');

    panel.get_items().getItem(i).set_enabled(false); where "i" is the panel that I want to disable, but this time only the header is disabled. its controls are enabled.

    I would like to make this:  (this.RadPanelBar1.Items[i] as RadPanelItem).Enabled= false in the client-side. Is it possible?

    Thanks.






  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2009 Link to this post

    Hello Manu,

    You can access the root PanelItem, disable it and then disable its children as shown in the code below:
    js:
      var panelBar = $find("<%= RadPanelBar1.ClientID %>");  
      var panelItem = panelBar.get_items().getItem(0);  
      panelItem.disable();  
      var children = panelItem.get_items();  
      for(var i=0;i<children.get_count();i++)  
      {  
        var childItem = children.getItem(i);  
        childItem.disable();  
      }  
     

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rodrigo olivares
    Rodrigo olivares avatar
    9 posts
    Member since:
    Sep 2009

    Posted 14 Oct 2009 Link to this post

    I have a problem, when disable items using trackchanges and SingleExpandedItem mode or seting disable in server side all controls inside de RadPanelItem are disabled no mathers if set enable througth javascript.

    ¿Any hint for this problem?

    I'  using this, is a accordeon like behavior.


    <telerik:RadPanelBar runat="server" ID="RadPanelFichaCliente" EnableEmbeddedSkins="false" 
            Skin="lv" ExpandMode="SingleExpandedItem" Width="655px" ExpandAnimation-Duration="100" 
            ExpandAnimation-Type="Linear" CollapseAnimation-Duration="200" CollapseAnimation-Type="Linear"
            <Items> 
                <telerik:RadPanelItem Text="Datos Personales" Expanded="true" Value="DatosPersonales"
                    <Items> 
                        <telerik:RadPanelItem Value="PERSONALES" runat="server" > 
                            <ItemTemplate> 
                                       <div> ..... 
                            </ItemTemplate> 
                        </telerik:RadPanelItem> 
                    </Items> 
                </telerik:RadPanelItem> 
                <telerik:RadPanelItem Text="Datos Comerciales"  Value="DatosPersonales"
                    <Items> 
                        <telerik:RadPanelItem Value="COMERCIALES" runat="server" > 
                            <ItemTemplate> 
                                       <div> ..... 
                            </ItemTemplate> 
                        </telerik:RadPanelItem> 
                    </Items> 
                </telerik:RadPanelItem> 
            </Items> 
    </telerik:RadPanelBar > 

  5. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 29 Jan 2010 Link to this post

    I'm experiencing the same issue as Rodrigo.  When I disable a RadPanelItem and then try to re-enable it on the client or server side, all of the controls within the panel stay disabled.  Is there a resolution for this?
  6. Rodrigo olivares
    Rodrigo olivares avatar
    9 posts
    Member since:
    Sep 2009

    Posted 29 Jan 2010 Link to this post

    I do not have solution for this issue.

    My "work-around" was to decide make manipulation all-onserver or all-onclient, updating the state of controls on Page Load or special control loads (client javascript)
  7. Rob
    Rob avatar
    115 posts
    Member since:
    Aug 2012

    Posted 29 Jan 2010 Link to this post

    I was disabling the panelitem on the Page_Load() event on the server side then trying to enable it on the client.  I went 100% client side and now I've got things working the way I would expect them to.

    Thanks Rodrigo!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017