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

Wiring up an eventhandler for child control

2 Answers 30 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Kennon McCaa
Top achievements
Rank 1
Kennon McCaa asked on 29 Jun 2009, 07:59 PM

Hi,

I have a UserControl (m_ucPolicyList) within a RadPanelBar.

<telerik:RadPanelBar runat="server" ID="m_rpbPageContent" Width="99%">
<Items>
<telerik:RadPanelItem  runat="server" Text="General Information" Width="100%" Value="General Information Panel" Expanded="true">
<ItemTemplate>
<div id="m_ldGeneralInfo" runat="server">
<tstUser:PolicyListControl ID="m_ucPolicyList" runat="server"/>
</div>
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelBar>

is there anyway to subscribe to events raised by my usercontrol (m_ucPolicyList)?

What I'm finding is that the UserControl (any control within a RadPanelBar) is not available to me at Page_Load and I have to wait for Page_PreRender to access it via the FindItemByValue() method. However, it appears that if I try to attach the eventhandler to my control in Page_PreRender it is too late in the page lifecycle to actually work.

I thought perhaps I could attach the eventhandler in the _ItemCreated event of the RadPanelBar but that event is not firing for me.

Any suggestions?

Thanks so much,

Kennon

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 30 Jun 2009, 09:06 AM
Hi Kennon McCaa,

All controls defined inside the ItemTemplate property of inline items (defined in the ASPX) should be available during Page_Load. I have attached a sample project which shows how to subscribe to events of child controls.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kennon McCaa
Top achievements
Rank 1
answered on 30 Jun 2009, 02:36 PM
Thanks. That example solved my problem. It may have been that my ASPX markup only had:
TstPanelBar
  Items
    RadPanelItem
      ItemTemplate

Whereas your example had:

TstPanelBar
  Items
    RadPanelItem
      Items
        RadPanelItem
          ItemTemplate

Is that the correct general structure, "2 RadPanelItems, not just 1"?

Thanks so much.
Tags
PanelBar
Asked by
Kennon McCaa
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Kennon McCaa
Top achievements
Rank 1
Share this question
or