模拟动网当前位置下拉菜单

模拟动网当前位置下拉菜单
如图:


代码如下:

public string GetBoardDropDownList(int paraParentID)
  {
   string BoardText = "<script language=\"javascript\" type=\"text/javascript\">";
   BoardText += "var boardxml='<?xml version=\"1.0\" encoding=\"gb2312\"?>";
   BoardText += "<BoardList>";
   BoardText +=BoardRec(0);
   BoardText += "</BoardList>';</script>";
   return BoardText;
  }
  public string BoardRec(int paraParentID)
  {
   string BoardText= "";
   DataSet ds1 = myCData.GetDataSet("select * from DV_Board where ParentID="+paraParentID+" order by orders Asc",0,0,"TableName");
   for(int j = 0;j<ds1.Tables[0].Rows.Count;j++)
   {
    int BoardID = Convert.ToInt32(ds1.Tables[0].Rows[j]["BoardID"]);
    string BoardType = ds1.Tables[0].Rows[j]["BoardType"].ToString();
    int Parentid = Convert.ToInt32(ds1.Tables[0].Rows[j]["parentid"]);
    int Depth = Convert.ToInt32(ds1.Tables[0].Rows[j]["depth"]);
    int Rootid = Convert.ToInt32(ds1.Tables[0].Rows[j]["rootid"]);
    int Child = Convert.ToInt32(ds1.Tables[0].Rows[j]["child"]);
    int Hidden = 0;
    int Nopost = 0;
    if(Child==0)
    {
     Nopost = 0;
     BoardText += "<board boardid=\""+BoardID+"\" boardtype=\""+BoardType+"\" parentid=\""+Parentid+"\" depth=\""+Depth+"\" rootid=\""+Rootid+"\" child=\""+Child+"\" hidden=\""+Hidden+"\" nopost=\""+Nopost+"\"></board>";
    }
    else
    {
     Nopost = 1;
     BoardText += "<board boardid=\""+BoardID+"\" boardtype=\""+BoardType+"\" parentid=\""+Parentid+"\" depth=\""+Depth+"\" rootid=\""+Rootid+"\" child=\""+Child+"\" hidden=\""+Hidden+"\" nopost=\""+Nopost+"\">";
     BoardText +=BoardRec(BoardID);
     BoardText +="</board>";
    }
   }
   ds1.Clear();
   return BoardText;
  }
  public string GetBoardPostioin(string paraBBSName,int paraBoardID)
  {
   string BoardText= "";
   BoardText = "<a href='index.aspx' onMouseOver=\"showmenu(event,BoardJumpList(0),'',0);\">"+paraBBSName+"</a>";
   BoardText += GetBoardPostioinRec(paraBoardID);
   return BoardText;
  }
  public string GetBoardPostioinRec(int paraParentID)
  {
   string BoardText= "";
   if(paraParentID!=0)
   {
    DataSet ds1 = myCData.GetDataSet("select * from DV_Board where BoardID="+paraParentID+" order by orders Asc",0,0,"TableName");
    if(ds1.Tables[0].Rows.Count>0)
    {
     if(Convert.ToInt32(ds1.Tables[0].Rows[0]["Child"])>0)
     {
      BoardText = " → <a href='index.aspx?BoardID="+ds1.Tables[0].Rows[0]["BoardID"].ToString()+"' onMouseOver=\"showmenu(event,BoardJumpList("+ds1.Tables[0].Rows[0]["BoardID"].ToString()+"),'',0);\">"+ds1.Tables[0].Rows[0]["BoardType"].ToString()+"</a>";
     }
     else
     {
      BoardText = " → <a href='index.aspx?BoardID="+ds1.Tables[0].Rows[0]["BoardID"].ToString()+"' >"+ds1.Tables[0].Rows[0]["BoardType"].ToString()+"</a>";
     }
     BoardText = GetBoardPostioinRec(Convert.ToInt32(ds1.Tables[0].Rows[0]["ParentID"])) + BoardText;
    }
    ds1.Clear();
   }
   return BoardText;
  }

你可能感兴趣的:(下拉菜单)