|
using System;
using System.Xml;
using System.Data;
namespace vigortecWeb
{
/// <summary>
/// menuBuilder ���K�n�y�z�C
/// </summary>
public class menuBuilder
{
public menuBuilder()
{
//
// TODO: �b���[�J�غc�禡���{���X
//
}
public string mainMenu(string xmlFile, string cssClass)
{
DataSet _ds = new DataSet();
_ds.ReadXml(xmlFile);
DataTable _dt = _ds.Tables[0];
string htmlTag = "";
for(int i =0; i < _dt.Rows.Count; i++)
{
string href = _dt.Rows[i]["Url"].ToString();
string javascript = "javascript:changeSub("+i+")";
htmlTag += "<A ";
htmlTag += " class = '"+cssClass+"' ";
htmlTag += " href = '"+javascript+"' ";
htmlTag += " >";
htmlTag += _dt.Rows[i]["Title"].ToString();
htmlTag += "</a>";
if(i < _dt.Rows.Count-1)
{
htmlTag += "<A style='color: gray;'>|</a>";
}
}
return htmlTag;
}
public string SubMenu(string xmlFile, string Parent, string cssClass,string ulCss, bool isFun)
{
DataSet _ds = new DataSet();
_ds.ReadXml(xmlFile);
DataTable _dt = _ds.Tables[0];
string htmlTag = "";
htmlTag += "<div>";
htmlTag += "<ul class='"+ulCss+"' style=''>";
int count = 0;
for(int i =0; i < _dt.Rows.Count; i++)
{
if(_dt.Rows[i]["Parent"].ToString().Trim().Equals(Parent))
{
string href = _dt.Rows[i]["Url"].ToString();
string javascript = "";
if(isFun)
{
javascript= "javascript: parent.main.location = \""+href+"\" ";
}
else
{
javascript = "javascript:showFun("+count+")";
}
htmlTag += "<li style='margin:0 0 0 -20;' >";
htmlTag += "<A ";
htmlTag += " name = 'linkA' ";
htmlTag += " title='"+href+"' ";
htmlTag += " class = '"+cssClass+"' ";//" w100' ";
htmlTag += " onclick = '"+javascript+"' ";
htmlTag += " >";
htmlTag += _dt.Rows[i]["Title"].ToString();
htmlTag += "</a><br>";
if(!isFun)
{
htmlTag += "<div id='divCate' align = left style='DISPLAY: none' name='divCate' ></div>";
}
htmlTag += "</li>";
count += 1;
}
}
htmlTag += "</ul></div>";
return htmlTag;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.