This is a migrated thread and some comments may be shown as answers.

JavaScript to disable a RadPanelItem and all its control

5 Answers 191 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
manu
Top achievements
Rank 1
manu asked on 15 Apr 2009, 01:54 PM
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.






5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Apr 2009, 09:09 AM
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.
0
Rodrigo olivares
Top achievements
Rank 1
answered on 14 Oct 2009, 10:26 PM
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 > 

0
Rob
Top achievements
Rank 1
answered on 29 Jan 2010, 06:07 PM
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?
0
Rodrigo olivares
Top achievements
Rank 1
answered on 29 Jan 2010, 06:25 PM
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)
0
Rob
Top achievements
Rank 1
answered on 29 Jan 2010, 06:52 PM
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!
Tags
PanelBar
Asked by
manu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Rodrigo olivares
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or