May 17, 2009, 5:39 AM
UpdatePanel and coolite control problem
Hi
It seems that if i have a Coolite Button with a menu set in markup, and i want to populate it from server during an Async Postback of an UpdatePanel, the menu items will be erased after performing another async postback to the same updatepanel.
simplified code to demonstrate my problem is below.
if you first press the "btnTrigger" button, it will asynchronously populate the coolite button's menu item, as expected.
but if you press the "btnAnotherTrigger" after that, update panel will "erase" the menu item from the coolite's button and will leave only the mark-up data (meaning a button with an empty menu).
Is there a resolution for this?
i would have used the Coolite Ajax but i need access to Page.Session object with doesn't exist in the Coolite ajax context.
It seems that if i have a Coolite Button with a menu set in markup, and i want to populate it from server during an Async Postback of an UpdatePanel, the menu items will be erased after performing another async postback to the same updatepanel.
simplified code to demonstrate my problem is below.
if you first press the "btnTrigger" button, it will asynchronously populate the coolite button's menu item, as expected.
but if you press the "btnAnotherTrigger" after that, update panel will "erase" the menu item from the coolite's button and will leave only the mark-up data (meaning a button with an empty menu).
Is there a resolution for this?
i would have used the Coolite Ajax but i need access to Page.Session object with doesn't exist in the Coolite ajax context.
<%@ Page Language="C#" EnableViewState="true" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server">
protected void btnTrigger_OnClick(object sender, EventArgs e)
{
btnCoolite.Menu[0].Items.Add(new Coolite.Ext.Web.MenuItem("Test"));
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ext:ScriptManager ID="ScriptManager2" runat="server" />
<asp:UpdatePanel runat="server" ID="updServer">
<ContentTemplate>
<ext:Button runat="server" ID="btnCoolite" EnableViewState="true">
<Menu>
<ext:Menu>
</ext:Menu>
</Menu>
</ext:Button>
<asp:Button ID="btnTrigger" runat="server" onclick="btnTrigger_OnClick" Text="I will inject Coolite Button's sub menu item" />
<asp:Button ID="btnAnotherTrigger" runat="server" Text="I will erase Coolite Button's sub menu" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>