private void Page_Load(object sender, System.EventArgs e)
{//Get xml file from web config
NavigationMenu.TreeNodeSrc =Server.MapPath(ConfigurationSettings.AppSettings["NavigationMenuFile"]); } WEB CONFIG文件里加入这一句: <add key="NavigationMenuFile" value="NavigationMenu.xml"/> 这两行代码配置啥意思啊我怎么在我的程序里配置以后,写不出来上述PageLode里的方法啊以下是我的配置: 我是按照这个方法弄得: 1.调用页面:private void Page_Load(object sender, System.EventArgs e)
{
//Get xml file from web config
NavigationMenu.TreeNodeSrc =Server.MapPath(ConfigurationSettings.AppSettings["NavigationMenuFile"]);
NavigationMenu.DataBind();
for(int i = 0;i < NavigationMenu.Nodes.Count;i++)
{
//Set attribute Tree
NavigationMenu.Nodes[i].DefaultStyle.Add("font-size","10");
NavigationMenu.Nodes[i].DefaultStyle.Add("font-weight","bold");
if (NavigationMenu.Nodes[i].Nodes.Count>0)
{
NavigationMenu.Nodes[i].ImageUrl = "Image/TreeImages/Rplus.gif";
}
else
{
//NavigationMenu.Nodes[i].ImageUrl = "Image/TreeImages/minus.gif";
NavigationMenu.Nodes[i].DefaultStyle.Add("margin-left","4");
}
for(int j = 0;j < NavigationMenu.Nodes[i].Nodes.Count;j++)
{
NavigationMenu.Nodes[i].Nodes[j].DefaultStyle.Add("font-size","9");
if (NavigationMenu.Nodes[i].Nodes[j].Nodes.Count>0)
{
NavigationMenu.Nodes[i].Nodes[j].ImageUrl = "Image/TreeImages/Rplus.gif";
NavigationMenu.Nodes[i].Nodes[j].DefaultStyle.Add("font-weight","bold");
}
else
{
NavigationMenu.Nodes[i].Nodes[j].DefaultStyle.Add("margin-left","4");
}
for(int k = 0;k < NavigationMenu.Nodes[i].Nodes[j].Nodes.Count;k++)
{
//NavigationMenu.Nodes[i].Nodes[j].Nodes[k].ImageUrl = "Image/TreeImages/minus.gif";
NavigationMenu.Nodes[i].Nodes[j].Nodes[k].DefaultStyle.Add("font-size","8");
NavigationMenu.Nodes[i].Nodes[j].Nodes[k].DefaultStyle.Add("margin-left","4");
}
}
}
}
2. NavigationMenu.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<TREENODES>
<TREENODE TEXT = "Customer Order" NavigateUrl = "COTop.aspx">
<TREENODE TEXT = "CO">
<TREENODE TEXT = "New" NavigateUrl = "CO/Page/SelectCreateWay.aspx"/>
<TREENODE TEXT = "Query" NavigateUrl = "CO/Page/COQueryCustomerOrder.aspx"/>
</TREENODE>
<TREENODE TEXT = "Shipto">
<TREENODE TEXT = "New" NavigateUrl = "CO/Page/CODetailShipmenttoNew.aspx"/>
<TREENODE TEXT = "Query" NavigateUrl = "CO/Page/COQueryShipment.aspx"/>
</TREENODE>
<TREENODE TEXT = "Item">
<TREENODE TEXT = "New" NavigateUrl = "CO/Page/COQueryCOforNewItem.aspx"/>
<TREENODE TEXT = "Query" NavigateUrl = "CO/Page/COQueryCOItem.aspx"/>
</TREENODE>
<TREENODE TEXT = "Component">
<TREENODE TEXT = "Query" NavigateUrl = "CO/Page/COQueryComponent.aspx"/>
</TREENODE>
<TREENODE TEXT = "CO Management">
<TREENODE TEXT = "Transfer CO Quantity" NavigateUrl = "CO/Page/COQueryItemForTransfer.aspx"/>
<TREENODE TEXT = "Hold Order Approval" NavigateUrl = "CO/Page/COApproveco.aspx"/>
<TREENODE TEXT = "Replace CO Sales Department" NavigateUrl = "CO/Page/COReleaseSaleDept.aspx"/>
<TREENODE TEXT = "Regional Purchase Order Receving" NavigateUrl = "CO/Page/COQueryRegPO.aspx"/>
<TREENODE TEXT = "EDI CO Receiving List" NavigateUrl = "CO/Page/COQueryEDIRecv.aspx"/>
<TREENODE TEXT = "Amend Order Quantity" NavigateUrl = "CO/Page/COQueryItemForAmend.aspx"/>
<TREENODE TEXT = "Change Date of Recognition" NavigateUrl = "CO/Page/COModifyRecogDate.aspx"/>
</TREENODE>
</TREENODE>
</TREENODES>
3. WEB CONFIG文件里加入这一句:
<add key="NavigationMenuFile" value="NavigationMenu.xml"/>