類似 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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 類似 MSDN 左邊導航樹效果的實現! [JavaScript + ASP] (轉)JavaScript
- 用CSS實現類似導航翻轉功能例子CSS
- 【前端】javascript實現導航欄筋斗雲效果特效前端JavaScript特效
- Vue.js+cube-ui(Scroll元件)實現類似頭條效果的橫向滾動導航條Vue.jsUI元件
- WPF/C#:實現導航功能C#
- 在鴻蒙中實現類似瀑布流效果鴻蒙
- JS實現 類似圖片3D效果JS3D
- 商城側欄導航效果實現詳解
- 在Asp.Net中實現類似DWR的功能ASP.NET
- Android中使用RecyclerView + SnapHelper實現類似ViewPager效果AndroidViewpager
- QT實現類似於網頁step 選單效果QT網頁
- vue2.0實現底部導航切換效果Vue
- C# SQLiteHelper類似SqlHelper類實現存取Sqlite資料庫C#SQLite資料庫
- JavaScript類似c#字串處理方法format()JavaScriptC#字串ORM
- 用JavaScript實現動畫效果 (轉)JavaScript動畫
- 不用匯入SDK就可實現導航--URI方式跳轉到各類地圖進行導航地圖
- Laravel 小技巧 - 讓路由實現類似 Model::query 的效果Laravel路由
- JavaScript橫向二級導航選單效果JavaScript
- css實現立體效果橫向導航選單CSS
- js實現的響應式導航選單效果JS
- 使用 JavaScript 實現靈活的固定導航功能JavaScript
- C# 簡單反射實現winform左側樹形導航,右側切換內容C#反射ORM
- 拖動滾動條實現側欄導航定位效果
- 實現類似IE的列印網頁功能 (轉)網頁
- javascript樹形導航選單例項程式碼JavaScript單例
- 實現左側導航和橫向導航
- Flutter 實現類似美團外賣店鋪頁面滑動效果Flutter
- iOS 類似美團外賣 app 兩個 tableView 聯動效果實現iOSAPPView
- 修改 support 包 TabLayout,實現新浪微博/即刻 APP 蚯蚓導航效果TabLayoutAPP
- 僅2步實現 拜拜 漢堡導航欄效果~ 全新底部導航互動(滑動隱藏)
- Tablayout實現導航欄TabLayout
- 分類導航
- mysql 效果類似split函式MySql函式
- 採用JavaScript+XML實現具有樹形選單功能的論壇側邊導航欄JavaScriptXML
- javascript底部具有跟隨效果的橫向導航選單JavaScript
- Javascript 類與靜態類的實現-js物件導向JavaScriptJS物件
- Javascript實現動畫效果JavaScript動畫
- GetX 實現類似微信轉發搜尋多選好友