Oct 23, 2014, 5:19 PM
[CLOSED] Create Panel w/MenuPanel at Page_Load in code behind
Hello,
I've been through a bunch of posts and tried a lot of different things and I can't for the life of my figure this out. In Page_Load in code behind I am creating a Panel and inside the panel I am creating a MenuPanel, and then the Panel is added to the PlaceHolder. The Panel gets rendered, but for some reason the MenuPanel is not showing up. Please look at my code below and let me know what I'm missing here, I'm using V2.5.1, thanks!
I've been through a bunch of posts and tried a lot of different things and I can't for the life of my figure this out. In Page_Load in code behind I am creating a Panel and inside the panel I am creating a MenuPanel, and then the Panel is added to the PlaceHolder. The Panel gets rendered, but for some reason the MenuPanel is not showing up. Please look at my code below and let me know what I'm missing here, I'm using V2.5.1, thanks!
<%@ Page Language="C#"%>
<%@ Register Assembly="Ext.NET" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Ext.Net.Panel dynPanel = new Ext.Net.Panel()
{
Title = "My Menu",
Height = 400,
Width = 200,
Collapsible = false,
MarginSpec = "20 0 0 20"
};
Ext.Net.MenuPanel menuPanel1 = new MenuPanel();
Ext.Net.Menu menu = new Ext.Net.Menu()
{
ShowSeparator = false,
};
Ext.Net.MenuItem menuItem;
for (int i = 1; i < 5; i++)
{
menuItem = new Ext.Net.MenuItem()
{
ID = "Menu_" + i.ToString(),
Text = "Menu" + i.ToString()
};
menu.Items.Add(menuItem);
}
menuPanel1.Add(menu);
dynPanel.Items.Add(menuPanel1);
this.myPlaceHolder.Controls.Add(dynPanel);
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ExtResourceManager" runat="server" DisableViewState="false" RenderStyles="Embedded" />
<asp:PlaceHolder ID="myPlaceHolder" runat="server"></asp:PlaceHolder>
</body>
</html>
JW
Last edited by Daniil; Oct 24, 2014 at 3:27 PM.
Reason: [CLOSED]