Hi There
I have master/content page with two ContentPlaceHolders: Nav and Main. both Nav and Main contain UserControls, where Nav has a navigation UserControl (RadPanel with RadTreeView) and Main has a RadGrid (kind of obvious, right ;-) ).
Obviously the objective is to populate the RadGrid with data dependent on the node that is clicked.
Instead of bubbling up events from the user controls, which I find awkward, I thought I could put the NodeClick Event Handler in the code behind on the content page and assign the event handler in the page load event:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
ContentPlaceHolder cph = (ContentPlaceHolder)
this
.Master.FindControl(
"ContentPlaceHolderNav"
);
RadPanelBar rpb = (RadPanelBar)cph.FindControl(
"RadPanelBar1"
);
RadPanelItem itm = (RadPanelItem)rpb.Items[1];
UserControl uc = (UserControl)itm.FindControl(
"Nav"
);
RadTreeView rtv = (RadTreeView)uc.FindControl(
"RadTreeView2"
);
rtv.NodeClick += RadTreeView1_NodeClick;
}
}
The code works - when stepping through I can see that the TreeView is found - but the event doesn't fire when clicking on a node (-> a breakpoint in RadTreeView1_NodeClick in the content page is not reached).
Is what I'm trying to do not possible? Or does this just need to go somewhere else in the page lifecycle (Page_Init?).
Thx in advance for help and/or pointers!
Rgds - Marcus.