R
R.A.M.
Hello,
I need your help with a problem concerning Menu control.
Could you help me please?
I have created custom Menu:
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;
}
}
which I try to use on .aspx page:
<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);
}
My Menu.xml file I have defined this way (I don't think it's correct
but I couldn't find an example):
<?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 are:
1. How to write XML for my menu correctly?
2. Menu is not displayed in browser, there's nothing in HTML about my
menu. Why? Because of invalid XML? Other reasons?
(MenuPlaceHolder...Add() works fine.)
Thank you very much for your answers!
/RAM/
I need your help with a problem concerning Menu control.
Could you help me please?
I have created custom Menu:
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;
}
}
which I try to use on .aspx page:
<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);
}
My Menu.xml file I have defined this way (I don't think it's correct
but I couldn't find an example):
<?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 are:
1. How to write XML for my menu correctly?
2. Menu is not displayed in browser, there's nothing in HTML about my
menu. Why? Because of invalid XML? Other reasons?
(MenuPlaceHolder...Add() works fine.)
Thank you very much for your answers!
/RAM/