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

Cannot access RadPanelBar1 from javascript

10 Answers 86 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
TAD RHODES
Top achievements
Rank 1
TAD RHODES asked on 18 May 2010, 09:29 PM
I have a radpanelbar that I need to access from js and i always get a compiler error saying RadPanelBar1 is not available in this context.
Code is posted below.

Also; before i added the panelbar the code was in an asp:panel and I couldnt access any radcontrols from my js, asp controls were fine, now I cant access any of them inside the panelbar.

js where I am attempting to access the panelbar
 
var title = $find('<%= RadPanelbar1.FindItemByValue("Content").FindControl("txtContentTitle").ClientID %>'); 

My radpanelbar and the controls inside of it.

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default"  
        Height="25px" InitialBehavior="None" Width="166px"></telerik:RadWindowManager> 
    <Windows> 
        <telerik:RadWindow Height="100px" Width="300px" OnClientClose="OnClientClose" EnableViewState="false" NavigateUrl="Dialog1.aspx" ID="rdWindow" runat="server" Behaviors="Close" VisibleOnPageLoad="true" DestroyOnClose="true" Modal="true" Visible="false"
        </telerik:RadWindow> 
    </Windows> 
 
    <div id="CMSContent"
        <cc1:RoundedDiv ID="rdContentInsert" runat="server" SkinsPath="~/App_Themes/Default/RoundedDiv/Skins" RoundBottomRight="true"  Skin="Blue"  Title="Add Content"
            <asp:Label ID="lblStatus" runat="server" CssClass="cmsStatus" ></asp:Label>  
 
            <telerik:RadPanelBar runat="server" ID="RadPanelBar1"  
                ExpandMode="FullExpandedItem" Width="800px"
                 
                <Items> 
                    <telerik:RadPanelItem runat="server" Value="Content Management" Text="Content" Expanded="true"
                        <Items> 
                            <telerik:RadPanelItem runat="server" Value="Content"
                                <ItemTemplate> 
                                    <table cellpadding="3">        
                                        <tr> 
                                            <td align="left" valign="top"
                                                <asp:TextBox ID="txtFileDescription" runat="server" MaxLength="50" CssClass="cmsFileDescription" 
                                                OnClick="clickclear(this, 'File Description')" OnBlur="clickrecall(this,'File Description')">File Description</asp:TextBox> 
                                            </td> 
                                            <td align="left" valign="top"  > 
                        
                                                <telerik:RadUpload ID="rulUploader" runat="server" CssClass="cmsUploader" AllowedFileExtensions=".jpg,.jpeg,.pjpeg,.gif,.png" ControlObjectsVisibility="None" MaxFileInputsCount="1" Skin="Vista"  
                                                AllowedMimeTypes="image/jpeg,image/gif,image/png,image/pjpeg" MaxFileSize="104857600" EnableViewState="true" > 
                                                </telerik:RadUpload> 
                      
                                            </td>       
                                            <td align="left" valign="top"
                                                <asp:Button ID="btnUpload" runat="server" Text="Upload Content" ValidationGroup="Editor" OnClick="btnUpload_Click" /> 
                                            </td> 
                                            <td align="left" valign="top"
                                                    <asp:Button ID="btnUploadCancel" runat="server" Text="Cancel Upload Mode" OnClick="btnUploadCancel_Click"  /> 
                                            </td> 
                                        </tr>    
                                    </table>   
                                    <asp:RequiredFieldValidator ID="rfvTitle" runat="server" ErrorMessage="*Please input a Title." Display="dynamic" ValidationGroup="Editor"  
                                        ControlToValidate="txtContentTitle" Font-Bold="true"></asp:RequiredFieldValidator> 
                                    <asp:RequiredFieldValidator ID="rfvFileDescr" runat="server" ErrorMessage="*Please input a File Description." Display="dynamic" ValidationGroup="Editor"  
                                        ControlToValidate="txtFileDescription" Font-Bold="true"></asp:RequiredFieldValidator> 
                                    <asp:RegularExpressionValidator ID="revFileDescription" runat="server" ErrorMessage="*File Description has illegal characters." Display="dynamic" 
                                        ValidationGroup="Editor" ControlToValidate="txtFileDescription" Font-Bold="true" ValidationExpression='^(([a-zA-Z]:|\\)\\)?(((\.)|(\.\.)|([^\\/:\*\?"\|<>\. ](([^\\/:\*\?"\|<>\. ])|([^\\/:\*\?"\|<>]*[^\\/:\*\?"\|<>\. ]))?))\\)*[^\\/:\*\?"\|<>\. ](([^\\/:\*\?"\|<>\. ])|([^\\/:\*\?"\|<>]*[^\\/:\*\?"\|<>\. ]))?$' ></asp:RegularExpressionValidator> 
                                    <asp:RequiredFieldValidator ID="rfvcbxContentType" runat="server" ErrorMessage="*Please select a content type." Display="dynamic" ValidationGroup="Editor"  
                                       ControlToValidate="cbxContentTypes" Font-Bold="true"></asp:RequiredFieldValidator> 
     
                                    <table cellpadding="3"
                                       <tr> 
                                            <td > 
                                                <asp:TextBox ID="txtContentTitle" runat="server" MaxLength="8000" CssClass="cmsContentTitle" 
                                                    OnClick="clickclear(this, 'Title')" OnBlur="clickrecall(this,'Title')">Title</asp:TextBox>             
                                            </td> 
                                        </tr> 
                                         <tr> 
                                            <td align="left" valign="top"
                                                <asp:TextBox ID="txtTagContent" runat="server" MaxLength="8000"  CssClass="cmsFileDescription" 
                                                OnClick="clickclear(this, 'Content Keywords')"  
                                                    OnBlur="clickrecall(this,'Content Keywords')" Width="800px">Content Keywords</asp:TextBox> 
                                            </td> 
                                            <td align="left" valign="top" > 
                                                <asp:Label ID="lblContentTypes" runat="server" Text="Content Type:"></asp:Label>&nbsp; 
                                            </td> 
                                            <td align="left" valign="top" > 
                                                <telerik:RadComboBox ID="cbxContentTypes" runat="server" />                 
                                            </td>                      
                                       </tr>    
                                       <tr> 
                                           <td> 
                                               <telerik:RadEditor ID="txtContent" runat="server"  
                                                   EnableResize="False" Skin="Outlook" Width="800px" Height="250px"  
                                                ToolbarMode="ShowOnFocus" ToolTip="Type Content Here"  
                                                   ToolsFile="../../App_Themes/Default/ToolsLimited.xml" >  
                                                   <CssFiles> 
                                                    <telerik:EditorCssFile Value="cmsContentText" /> 
                                                   </CssFiles>  
                                               </telerik:RadEditor> 
                                            </td> 
                                            <td align="left" valign="top"
                                                <asp:Label ID="lblActive" runat="server" Text="Content Active:"></asp:Label><br /> 
                                                <br /> 
                                                <br />          
                                                <asp:Label ID="lblActiveFrom" runat="server" Text="Active From:" CssClass="cmsFromLabel" ></asp:Label><br /> 
                                                <br /> 
                                                <asp:Label ID="lblActiveTo" runat="server" Text="Active To:"></asp:Label></td
                                            <td align="left" valign="top" style="width: 182px"
                                                <asp:CheckBox ID="chkActive" runat="server" /> 
                                                <br /> 
                                                <br />              
                                                <telerik:RadDateTimePicker ID="dtpFromDate" runat="server"  
                                                    MaxDate="9999-12-31 11:59:59 PM" MinDate="2010-05-11"  />   
                                                <br /> 
                                                <br /> 
                                                <telerik:RadDateTimePicker ID="dtpToDate" runat="server" MaxDate="9999-12-31 11:59:59 PM" />    
                                            </td>          
                                        </tr> 
                                        <tr> 
                                           <td> 
                                                <asp:Button ID="btnInsertContent" runat="server" Text="Save Content" OnClick="btnInsertContent_Click" /> 
                                                &nbsp;&nbsp;        
                                                <asp:Button ID="btnClear" runat="server" Text="Cancel"  
                                                    onclick="btnClear_Click" /> 
                                            </td> 
                                        </tr>     
                                    </table> 
                        
                                </ItemTemplate> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelItem>                 
                </Items> 
            </telerik:RadPanelBar>       
    </cc1:RoundedDiv>    
    </div> 
 

Thank you
Neil

10 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 19 May 2010, 04:00 PM
Hi TAD RHODES,

About accessing RadPanelBar from js:
- please, try the following:
var panelBar = "<%= RadPanelBar1.ClientID %>";
var contentPanelItem = panelBar.get_items().get_item(0);
var txtContentTitleControl = contentPanelItem.findControl("txtContentTitle");

Hope this will help you!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TAD RHODES
Top achievements
Rank 1
answered on 19 May 2010, 06:09 PM
Hi Nikolay:

Thank you for the response. Your suggestion now allows my code to build successfully. However; Now some of the controls are not displaying. From the code that I posted originally, there are two tables inside the panelitem, the first displays great, but nothing from the second table in that region shows up.

Let me know what your thoughts are.

Thanks again.
0
Nikolay Tsenkov
Telerik team
answered on 20 May 2010, 11:56 AM
Hello TAD RHODES,

Could you please open a support ticket and send me a simple project reproducing this problem.
This will be easier and faster for me and for you too, to resolve the problem. Otherwise we probably are going to exchange big amount of questions and answers between each other.

In case you want to stay on the same way:
- Does it appear at all (the second table) or it hides after performing some js client-side operations?
- How does the items are loaded on the server?
For both questions - please provide source-code!

Again the easier way is to open a support ticket and send me a sample project.

Anyway, I hope we will resolve the problem you have!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TAD RHODES
Top achievements
Rank 1
answered on 08 Jun 2010, 08:16 PM
Hi Nikolay:

Thank you for the code snippet about the radpanelbar. However; I am still having trouble with this control. I can get the ID of it, but the
panelBar.get_items().get_item(0); doesnt return anything. I put an alert() after this step and I get nothing. I was wondering if  you had any further suggestions.

Thanks
0
Nikolay Tsenkov
Telerik team
answered on 09 Jun 2010, 12:23 PM
Hi TAD RHODES,

The correct call to this function would be "panelItemCollection.getItem(index)".
Now it should be working!

Hope this is going to help you!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TAD RHODES
Top achievements
Rank 1
answered on 11 Jun 2010, 07:32 PM
Hi Nikolay:

Thanks for you reply. I still cannot get access to the panel collection. I implemented your suggestion to use

var contentPanelItem = panelBar.panelItemCollection.getItem(0) 

Did I not implement it correctly or is there something else going on?

Thanks.


0
Nikolay Tsenkov
Telerik team
answered on 14 Jun 2010, 01:32 PM
Hi TAD RHODES,

Well, by panelItemCollection I meant the variable of this type.

In your previous code you were getting this collection right by:
panelBar.get_items()
But then you were calling a method which doesn't exist over this type:
panelBar.get_items().get_item(0)
While it should be:
panelBar.get_items().getItem(0)

That is why I wrote: "The correct call to this function would be "panelItemCollection.getItem(index)".".

Now it should be working!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
TAD RHODES
Top achievements
Rank 1
answered on 14 Jun 2010, 02:25 PM
Good Morning Nikolay:

I have not been able to get any part of the collection to this point. All I have been able to do is get the reference to the panelbar. The code snippet you just sent me I had already implemented, i mistyped when I sent you that last response with panelitemcollection as part of the actual js code.

I have tried, FindItemByText, FindItemByValue etc. and nothing ever gets returned.

Is there anything that could cause this to be happening. I am returning from a modal window at this point in the code and I am wanting to clear fields in the panelbar based on a response from the modal window.

Thanks in advance for your continued help.
0
Nikolay Tsenkov
Telerik team
answered on 15 Jun 2010, 09:03 AM
Hello TAD RHODES,

Could you please open a support ticket and send me a simple project reproducing the problem?

This is the best way to determine what is the nature of the problem.

 

Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nikolay Tsenkov
Telerik team
answered on 15 Jun 2010, 09:03 AM
Hello TAD RHODES,

Could you please open a support ticket and send me a simple project reproducing the problem?

This is the best way to determine what is the nature of the problem.

 

Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
PanelBar
Asked by
TAD RHODES
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
TAD RHODES
Top achievements
Rank 1
Share this question
or