類似 MSDN 導航樹效果 ASP.Net(C#) + JavaScript 實現! (轉)
類似 MSDN 導航樹效果 ASP.Net(C#) + JavaScript 實現! (轉)[@more@]
WebFORM1
WebFORM2
string ParentNode;
ParentNode = Request.QueryString["pnode"];
//Response.Write(ParentNode.Replace("_",""));
int i;
int j;
string nSpace="";
j= ParentNode.Length - ParentNode.Replace("_","").Length;
for (i=0;i nSpace = nSpace + " ";
string sHTML ="";
i=0;
System.Data.OleDb.OleDbConnection oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
oleDbConnection1.ConnectionString =@"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=TRIATONPSQL2KE";
oleDbConnection1.ConnectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/dvbbs") + @"Tree.mdb;Persist Security Info=False";
oleDbConnection1.Open();
System.Data.OleDb.OleDbCommand OleDbCommand1 = new System.Data.OleDb.OleDbCommand("select *,(select count(*) from tree where parentid =T.id ) as Children from tree T where parentid = " + Request.QueryString["PID"],oleDbConnection1) ;
System.Data.OleDb.OleDbDataReader OleDbDataReader1 = OleDbCommand1.ExecuteReader();
while (OleDbDataReader1.Read())
{
sHTML = sHTML + "
if (System.Convert.ToInt64(OleDbDataReader1["children"])>0)
sHTML = sHTML + " ";
i++;
}
Response.Write(sHTML);
%>
測試站點:
/tree/FORM1.x">
雖然號稱 了!
但實際還是傳統 CGI、ASP 的思想,沒有使用Codebehind="WebFORM1.aspx.cs",仍然採取了 B/S 混合(HTML/)指令碼的方式:
|
string ParentNode;
ParentNode = Request.QueryString["pnode"];
//Response.Write(ParentNode.Replace("_",""));
int i;
int j;
string nSpace="";
j= ParentNode.Length - ParentNode.Replace("_","").Length;
for (i=0;i
string sHTML ="";
i=0;
System.Data.OleDb.OleDbConnection oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
oleDbConnection1.ConnectionString =@"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=TRIATONPSQL2KE";
oleDbConnection1.ConnectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/dvbbs") + @"Tree.mdb;Persist Security Info=False";
oleDbConnection1.Open();
System.Data.OleDb.OleDbCommand OleDbCommand1 = new System.Data.OleDb.OleDbCommand("select *,(select count(*) from tree where parentid =T.id ) as Children from tree T where parentid = " + Request.QueryString["PID"],oleDbConnection1) ;
System.Data.OleDb.OleDbDataReader OleDbDataReader1 = OleDbCommand1.ExecuteReader();
while (OleDbDataReader1.Read())
{
sHTML = sHTML + "
" + nSpace + " if (System.Convert.ToInt64(OleDbDataReader1["children"])>0)
sHTML = sHTML + " onClick='ExpandNode(" + ParentNode + "_" + (i + 1).ToString() + "," + OleDbDataReader1["id"] + ")'>+";
else
sHTML = sHTML + ">-";
sHTML = sHTML + "n" + " if (System.Convert.ToInt64(OleDbDataReader1["children"])>0)
sHTML = sHTML + " onDblClick='ExpandNode(" + ParentNode + "_" + (i + 1).ToString() + "," + OleDbDataReader1["id"] + ")'";
sHTML = sHTML + ">" + OleDbDataReader1["id"] + ": " + OleDbDataReader1["remark"] + "
"; sHTML = sHTML + " onClick='ExpandNode(" + ParentNode + "_" + (i + 1).ToString() + "," + OleDbDataReader1["id"] + ")'>+";
else
sHTML = sHTML + ">-";
sHTML = sHTML + "n" + " if (System.Convert.ToInt64(OleDbDataReader1["children"])>0)
sHTML = sHTML + " onDblClick='ExpandNode(" + ParentNode + "_" + (i + 1).ToString() + "," + OleDbDataReader1["id"] + ")'";
sHTML = sHTML + ">" + OleDbDataReader1["id"] + ": " + OleDbDataReader1["remark"] + "
if (System.Convert.ToInt64(OleDbDataReader1["children"])>0)
sHTML = sHTML + " ";
i++;
}
Response.Write(sHTML);
%>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-998836/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【前端】javascript實現導航欄筋斗雲效果特效前端JavaScript特效
- Vue.js+cube-ui(Scroll元件)實現類似頭條效果的橫向滾動導航條Vue.jsUI元件
- WPF/C#:實現導航功能C#
- JavaScript slide下拉導航選單效果JavaScriptIDE
- 在鴻蒙中實現類似瀑布流效果鴻蒙
- vue2.0實現底部導航切換效果Vue
- Laravel 小技巧 - 讓路由實現類似 Model::query 的效果Laravel路由
- JavaScript橫向二級導航選單效果JavaScript
- C# 簡單反射實現winform左側樹形導航,右側切換內容C#反射ORM
- mysql 效果類似split函式MySql函式
- Flutter 實現類似美團外賣店鋪頁面滑動效果Flutter
- 僅2步實現 拜拜 漢堡導航欄效果~ 全新底部導航互動(滑動隱藏)
- 採用JavaScript+XML實現具有樹形選單功能的論壇側邊導航欄JavaScriptXML
- GetX 實現類似微信轉發搜尋多選好友
- 修改 support 包 TabLayout,實現新浪微博/即刻 APP 蚯蚓導航效果TabLayoutAPP
- C#樹的實現C#
- SpringBoot+WebFlux透過流式響應實現類似ChatGPT的打字機效果Spring BootWebUXChatGPT
- PostgreSQL類似OracleMERGE功能的實現SQLOracle
- 分類導航
- JavaScript實現HTML導航欄下拉選單[懸浮顯示]JavaScriptHTML
- 底部導航欄懸浮效果
- ReactNative實現地圖導航React地圖
- 小程式底部彈框 類似picker效果
- JavaScript 二叉搜尋樹以及實現翻轉二叉樹JavaScript二叉樹
- JavaScript實現選項卡效果JavaScript
- JavaScript實現文字豎排效果JavaScript
- 如何在 web 頁面中實現類似 excel 固定表頭 / 標題行的效果?WebExcel
- 如何實現園區路線導航?園區樓宇地圖導航如何實現?地圖
- 室內導航用什麼來實現?通過什麼可以實現導航功能?
- ASP.NET Web Forms – 導航簡介ASP.NETWebORM
- CSS多級導航選單效果CSS
- IntersectionObserver + scrollIntoView 實現電梯導航ServerView
- flutter實現類似優惠券樣式Flutter
- Flutter 實現類似TabPicker省市區選擇Flutter
- 如何在技術上實現室內導航?室內地圖導航怎麼實現?地圖
- 類似微信首頁彈性滾動和慣性滾動效果的實現——OverScroll
- CSS3動畫效果下拉導航選單效果CSSS3動畫
- JavaScript實現隨機抽獎效果JavaScript隨機
- 自學C#,要懂得善用MSDNC#