我有 html 格式的 sting 值数据如何应用 css 和 jquery 样式
public class Menus
{
public List<Menus> GetALL { get; set; }
public int menuId { get; set; }
public string menuName { get; set; }
public string menuURL { get; set; }
public int parentId { get; set; }
}
public class MenuModel
{
public MenuItemsEntities objEntities = new MenuItemsEntities();
public string GetMenu()
{
//Get MainMenu Menus
Menus menuobj = new Menus();
var objmenu = from menus in objEntities.MenuItems
where menus.ParentId == 0
select menus;
string strMenuBuild = string.Empty;
strMenuBuild += "<ul>";
foreach (var i in objmenu)
{
menuobj.menuName = i.ItemName;
menuobj.menuId = i.MenuItemsID;
menuobj.menuURL = i.URL;
if (i.ParentId == 0)
{
//GetSubMenu();
strMenuBuild = strMenuBuild + "<li><a href='" + menuobj.menuURL + "'>" + menuobj.menuName + "</a><ul>";
strMenuBuild += GetSubMenu(Convert.ToInt32(menuobj.menuId)) + "</ul></li>";
//strMenuBuild += "</ul></li>";
}
}
strMenuBuild += "</ul>";
return strMenuBuild;
}
public string GetSubMenu(int submenuid)
{
string strSubBuild = string.Empty;
Menus menuobj = new Menus();
var submenu= from menus in objEntities.MenuItems
where menus.ParentId == submenuid
select menus;
if (submenu.Count() > 0)
{
foreach (var sbmnu in submenu)
{
menuobj.menuURL = sbmnu.URL;
menuobj.menuName = sbmnu.ItemName;
menuobj.menuId = sbmnu.MenuItemsID;
strSubBuild = strSubBuild + "<li ><a href='" + menuobj.menuURL + "'>" + menuobj.menuName + "</a>";
var submneu1 = from menus in objEntities.MenuItems
where menus.ParentId == menuobj.menuId
select menus;
if (submneu1.Count() > 0)
{
strSubBuild += "<ul>";
strSubBuild += GetSubMenu(Convert.ToInt32(menuobj.menuId));
strSubBuild += "</ul>";
}
strSubBuild += "</li>";
}
}
return strSubBuild;
}
}
我已经像这样返回到 String In Html formate
- 菜单的配饰
- 衬衫
- T 恤
- H3子菜单1
- 牛仔裤
- P1子菜单1
- P2子菜单2
- 裤子
- 运动服
- Women'sMenu' Apperals
- 纱丽
- 裙子
- 裤子
- 手机
- 手机
- 平板电脑
- 存储卡
- 蓝牙
- 珠宝首饰
- 收入
- 戒指
- 链条
- 儿童珠宝
但是我绑定了菜单和子菜单。我想应用 css 和 jquery。如何应用 css 和 jquery 我不知道。任何人都可以帮我..