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

Faulty documentation for RadPanelBar?

8 Answers 93 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
improwise
Top achievements
Rank 1
Iron
Iron
improwise asked on 28 Mar 2012, 02:54 PM
If you look at the documentation for RadPanelBar, you will find:

All server controls located in the templates are directly accessible by their IDs on Page-level. Instead of using the common syntax
        RadPanelBar1.Items[0].Header.FindControl("RadMenu1") //inside a HeaderTemplate
        RadPanelBar1.Items[0].FindControl("RadMultiPage1") //inside a ContentTemplate
    
you can use RadMenu1 or RadMultiPage1 to reference the control located inside the respective template of the first root Item of a PanelBar.
 

However, trying to actually use this functionality, it seems like controls within a RadPanelBar are not accessible without using the FindControl(). In a RadMultiPage though, it seems possible. Other post by Telerik personel here in the forum seem to confirm this. Or am I missing something here?

http://demos.telerik.com/aspnet-ajax/panelbar/examples/functionality/templates/defaultcs.aspx

8 Answers, 1 is accepted

Sort by
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 28 Mar 2012, 03:15 PM
Actually, this seems to be semi-true. We can access controls in a RadPanelBar from code behind, but it seems other designers, like ObjectDataSource, can't find the controls that are in a RadPanelBar. That is, you can not choose to bind a parameter to a control residing within a RadPanelBar. Why is this and is there as solution (other than setting it in code behind)?

And if the controls are accessible directly, why are there several posts here where support personnel from Telerik tell people to use the FindControl(), when it seems to work by naming them directly?  

Perhaps I could rephrase, when will it work to access controls directly and when won't it? :)
0
Kate
Telerik team
answered on 02 Apr 2012, 11:31 AM
Hi Patrik,

Using header and content templates of the RadPanelItems you can directly access the needed control meaning that simply typing the  id of the control directly in the Page_Load event  is identical to typing the below lines of code (you can also refer to the attached image):
var menu = panelbar1.Items[0].Header.FindControl("menu1");
var menuu = panelbar1.Items[1].FindControl("menu3");

However, you can not use the above mentioned approach when you have an ItemTemplate.

Considering your other question with databinding can you please elaborate a bit more since I am not quite sure that I completely understand your question?

Kind regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 02 Apr 2012, 12:24 PM
If you try to reference the controls from code behind it will work, but if you try to use them in designers in design view it won't work. Like if you add an ObjectDataSource to the page, and then try to select any of the controls within the RadPanelBar to provide values for one of the parameters, it won't show up in the list of available controls. Please let me know if this explanation makes sense :)
0
Kate
Telerik team
answered on 03 Apr 2012, 12:25 PM
Hi Patrik,

Yes, it does make sense but currently you can bind a control that is in a template by using code behind as exemplified in the following help article -  Adding Templates at run-time.

All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Saikat
Top achievements
Rank 1
answered on 21 Apr 2012, 04:46 PM
Hi Kate,
"Using header and content templates of the RadPanelItems you can directly access the needed control meaning that simply typing the id of the control directly in the Page_Load event .."
Is this statement valid for nested repeater controls also?If not, whats the way to find a nested repeater control?

THanks,
Saikat
0
Kate
Telerik team
answered on 25 Apr 2012, 02:29 PM
Hi Saikat,

The approach that I described is valid for any control that you place in the header and/or content templates of the RadPanelBar control. However, if your question is related to the asp Repeater control I would suggest that you take a look at the following post where it is explained how you can find a control placed in a template of a Repeater - How to find controls in a repeater header or footer 

All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
improwise
Top achievements
Rank 1
Iron
Iron
answered on 25 Apr 2012, 02:48 PM
Please note that this thread is about faulty documentation, which claims that you can access controls in "templates" just by using their IDs, but reality is that this only works in a few cases, but not in others. Should perhaps be highlighted.
0
Kate
Telerik team
answered on 26 Apr 2012, 01:34 PM
Hello Patrik,

The demo that you refer to demonstrates that controls placed in Header and /or Content templates of RadPanelBar are accessible directly from the page. For instance if you place a RadAjaxManager control on the page containing a RadPanelBar with templates, you would be able to find any control placed in the template. Did you try to reproduce the same issue with any other asp.net control? Can you also record a video that demonstrates the issue that you describe in designers in design views since I am not completely sure that I understand it?

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
PanelBar
Asked by
improwise
Top achievements
Rank 1
Iron
Iron
Answers by
improwise
Top achievements
Rank 1
Iron
Iron
Kate
Telerik team
Saikat
Top achievements
Rank 1
Share this question
or