R
R.A.M.
Hello,
I need your help with a problem of menu definition. Plase help, I have
little experience.
I have created custom Menu, which I want to put on a few .aspx pages:
public class DemoMenu : Menu
{
public DemoMenu(string ID, string DataSourceID)
: base()
{
this.ID = ID;
DataSourceID = DataSourceID;
StaticMenuItemStyle.BackColor = Color.LightBlue;
StaticMenuItemStyle.ForeColor = Color.Black;
StaticHoverStyle.BackColor = Color.Blue;
StaticHoverStyle.ForeColor = Color.White;
DynamicMenuItemStyle.BackColor = Color.LightBlue;
DynamicMenuItemStyle.ForeColor = Color.Black;
DynamicHoverStyle.BackColor = Color.Blue;
DynamicHoverStyle.ForeColor = Color.White;
}
}
in this way, for instance:
<form id="DemoForm" runat="server">
<asp:XmlDataSource ID="MenuDataSource" runat="server"
DataFile="App_Data/Menu.xml" />
<asplaceHolder ID="MenuPlaceHolder" runat="server" />
</form>
....
protected void Page_Load(object sender, EventArgs e)
{
// Put custom menu:
DemoMenu menu = new DemoMenu("DemoMenu", "MenuDataSource");
MenuPlaceHolder.Controls.Add(menu);
}
I defined file Menu.xml in this way (XML is invalid I think, because I
could not find an example nor syntax description):
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Items>
<MenuItem Text="Files" Value="Files">
<MenuItem Text="Readinng text file" Value="ReadTXT"
NavigateUrl="~/ReadTXT.aspx" />
<MenuItem Text="Reading XML file" Value="ReadXML"
NavigateUrl="~/ReadXML.aspx" />
</MenuItem>
<MenuItem Text="Databases" Value="Databases">
<MenuItem Text="Selecting data using AccessDataSource"
Value="AccessDataSource" NavigateUrl="~/AccessDataSource.aspx" />
<MenuItem Text="Selecting data from MS Access"
Value="ReadMSAccess" NavigateUrl="~/ReadMSAccess.aspx" />
<MenuItem Text="Selecting data from SQL Server"
Value="ReadSQLServer" NavigateUrl="~/ReadSQLServer.aspx" />
</MenuItem>
</Items>
MY questions:
1. What is the correct Menu.xml contents? Is it described somewhere?
2. Menu is not displayed in a browser, there's nothing in HTML. Why?
Because of invalid Menu.xml? Other reasons?
(MenuPlaceHolder...Add() works fine.)
Thank you very much for your answers!
/RAM/
I need your help with a problem of menu definition. Plase help, I have
little experience.
I have created custom Menu, which I want to put on a few .aspx pages:
public class DemoMenu : Menu
{
public DemoMenu(string ID, string DataSourceID)
: base()
{
this.ID = ID;
DataSourceID = DataSourceID;
StaticMenuItemStyle.BackColor = Color.LightBlue;
StaticMenuItemStyle.ForeColor = Color.Black;
StaticHoverStyle.BackColor = Color.Blue;
StaticHoverStyle.ForeColor = Color.White;
DynamicMenuItemStyle.BackColor = Color.LightBlue;
DynamicMenuItemStyle.ForeColor = Color.Black;
DynamicHoverStyle.BackColor = Color.Blue;
DynamicHoverStyle.ForeColor = Color.White;
}
}
in this way, for instance:
<form id="DemoForm" runat="server">
<asp:XmlDataSource ID="MenuDataSource" runat="server"
DataFile="App_Data/Menu.xml" />
<asplaceHolder ID="MenuPlaceHolder" runat="server" />
</form>
....
protected void Page_Load(object sender, EventArgs e)
{
// Put custom menu:
DemoMenu menu = new DemoMenu("DemoMenu", "MenuDataSource");
MenuPlaceHolder.Controls.Add(menu);
}
I defined file Menu.xml in this way (XML is invalid I think, because I
could not find an example nor syntax description):
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Items>
<MenuItem Text="Files" Value="Files">
<MenuItem Text="Readinng text file" Value="ReadTXT"
NavigateUrl="~/ReadTXT.aspx" />
<MenuItem Text="Reading XML file" Value="ReadXML"
NavigateUrl="~/ReadXML.aspx" />
</MenuItem>
<MenuItem Text="Databases" Value="Databases">
<MenuItem Text="Selecting data using AccessDataSource"
Value="AccessDataSource" NavigateUrl="~/AccessDataSource.aspx" />
<MenuItem Text="Selecting data from MS Access"
Value="ReadMSAccess" NavigateUrl="~/ReadMSAccess.aspx" />
<MenuItem Text="Selecting data from SQL Server"
Value="ReadSQLServer" NavigateUrl="~/ReadSQLServer.aspx" />
</MenuItem>
</Items>
MY questions:
1. What is the correct Menu.xml contents? Is it described somewhere?
2. Menu is not displayed in a browser, there's nothing in HTML. Why?
Because of invalid Menu.xml? Other reasons?
(MenuPlaceHolder...Add() works fine.)
Thank you very much for your answers!
/RAM/