I've created an ascx control like this:
<telerik:RadAjaxPanel runat="server" ID="rpan">
<div style="width: 400px;">
<telerik:RadToolBar runat="server" ID="rToolBar"
OnClientButtonClicking="onItemClicking" onbuttonclick="rToolBar_ButtonClick">
</telerik:RadToolBar>
</div>
<telerik:RadTreeView runat="server" ID="rTree"
Skin="Vista"
DataFieldID="ID"
DataFieldParentID="idParent"
DataTextField="Cd_Menu"
DataValueField="link"
OnClientDoubleClick="OnDoubleClick"
OnNodeEdit="RadTreeView1_NodeEdit"
EnableDragAndDrop="false"
EnableDragAndDropBetweenNodes="false"
OnNodeDrop="RadTreeView1_HandleDrop"
OnClientNodeClicked="onNodeClicked"
OnClientNodeClicking="onNodeClicking"
OnClientNodeDropping="onNodeDropping"
OnClientNodeDragging="onNodeDragging"
OnNodeDatabound="rTree_NodeDataBound">
</telerik:RadTreeView>
</telerik:RadAjaxPanel>
I also have an aspx page with a RadMenu created at runtime with databinding.
I tried to add the ascx control inside a RadMenuItem server side:
Telerik.Web.UI.RadMenuItem subRmi = new Telerik.Web.UI.RadMenuItem();
subRmi.ItemTemplate = new FavouritesTemplate(this.Page);
I have declared this class inside the same aspx page:
class FavouritesTemplate : ITemplate
{
private Page _page = null;
public FavouritesTemplate(Page page)
{
this._page = page;
}
public void InstantiateIn(System.Web.UI.Control container)
{
Favourites fav = ((Favourites)this._page.LoadControl("~/Web.UserControls/Favourites.ascx"));
fav.ID = "favourites";
container.Controls.Add(fav);
}
}
The ascx control inside the RadMenuItem is shown correctly but doesn't work properly.
Clicking on a RadToolBarButton the whole aspx page do postback instead of only the ascx content (because of RadAjaxPanel)
Putting the same ascx control directly inside the aspx page (not inside the the RadMenuItem) works as expected (partial postback of the ascx content)
<telerik:RadAjaxPanel runat="server" ID="rpan">
<div style="width: 400px;">
<telerik:RadToolBar runat="server" ID="rToolBar"
OnClientButtonClicking="onItemClicking" onbuttonclick="rToolBar_ButtonClick">
</telerik:RadToolBar>
</div>
<telerik:RadTreeView runat="server" ID="rTree"
Skin="Vista"
DataFieldID="ID"
DataFieldParentID="idParent"
DataTextField="Cd_Menu"
DataValueField="link"
OnClientDoubleClick="OnDoubleClick"
OnNodeEdit="RadTreeView1_NodeEdit"
EnableDragAndDrop="false"
EnableDragAndDropBetweenNodes="false"
OnNodeDrop="RadTreeView1_HandleDrop"
OnClientNodeClicked="onNodeClicked"
OnClientNodeClicking="onNodeClicking"
OnClientNodeDropping="onNodeDropping"
OnClientNodeDragging="onNodeDragging"
OnNodeDatabound="rTree_NodeDataBound">
</telerik:RadTreeView>
</telerik:RadAjaxPanel>
I also have an aspx page with a RadMenu created at runtime with databinding.
I tried to add the ascx control inside a RadMenuItem server side:
Telerik.Web.UI.RadMenuItem subRmi = new Telerik.Web.UI.RadMenuItem();
subRmi.ItemTemplate = new FavouritesTemplate(this.Page);
I have declared this class inside the same aspx page:
class FavouritesTemplate : ITemplate
{
private Page _page = null;
public FavouritesTemplate(Page page)
{
this._page = page;
}
public void InstantiateIn(System.Web.UI.Control container)
{
Favourites fav = ((Favourites)this._page.LoadControl("~/Web.UserControls/Favourites.ascx"));
fav.ID = "favourites";
container.Controls.Add(fav);
}
}
The ascx control inside the RadMenuItem is shown correctly but doesn't work properly.
Clicking on a RadToolBarButton the whole aspx page do postback instead of only the ascx content (because of RadAjaxPanel)
Putting the same ascx control directly inside the aspx page (not inside the the RadMenuItem) works as expected (partial postback of the ascx content)