usingSystem;usingSystem.Collections.Generic;usingSystem.Web;usin"> usingSystem;usingSystem.Collections.Generic;usingSystem.Web;usin" />
欢迎来到天天文库
浏览记录
ID:40740229
大小:44.50 KB
页数:6页
时间:2019-08-07
《c#加载树代码例子》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、c#加载树代码例子<%@WebHandlerLanguage="C#"Class="GetTreeHtml"%>usingSystem;usingSystem.Collections.Generic;usingSystem.Web;usingSystem.Data;usingSystem.Data.Common;usingSystem.Web.SessionState;usingSystem.Text;usingeMIS;usingeMIS.Data;publicclassGetTreeHtml:IHttpHandler,IRequi
2、resSessionState{publicvoidProcessRequest(HttpContextcontext){strings;inti;stringnid=context.Request.QueryString["nid"].ToString();s=context.Request.QueryString["fields"].ToString();string[]fields=s.Split(',');stringtable=context.Request.QueryString["table"].ToString();i
3、ntlevel=int.Parse(context.Request.QueryString["level"].ToString());stringparentValues=context.Request.QueryString["values"].ToString();string[]values=parentValues.Split(',');stringcondition=context.Request.QueryString["con"].ToString();booliscom=(context.Request.QuerySt
4、ring["count"].ToString()=="1");stringunit=context.Request.QueryString["unit"].ToString();boolIsParent;boolIsLast;intIsDisabled;stringnewnid;stringwwwroot=context.Request.ApplicationPath;if(wwwroot=="/")wwwroot="";stringimgpath=wwwroot+"/Common6/Code/Elements/Tree/Images
5、";StringBuildersb=newStringBuilder();sb.Append("");stringsqlwhere;stringsql="selectdistinct"+fields[level]+"from"+table;if(condition=="")sqlwhere="where1=1";elsesqlwhere="where"+condition+"";for(i=1;i<=level;i++){sqlwhere+=
6、"and"+fields[i-1]+"='"+values[i-1]+"'";}sql+=sqlwhere+"orderby"+fields[level];if(level==fields.Length-1)IsParent=false;elseIsParent=true;DataManagerdm=newDataManager();DataTabledt=dm.ExecuteTable(sql);intl=dt.Rows.Count;stringdesc,Img1,Img2,Img3,pvalues,count;for(i=0;i<
7、l;i++){newnid=nid+"_"+i.ToString();desc=dt.Rows[i][0].ToString();if(i==l-1)IsLast=true;elseIsLast=false;if(IsParent)IsDisabled=0;elseIsDisabled=1;if(IsParent){if(IsLast)Img1=imgpath+"/img-plus-end.gif";elseImg1=imgpath+"/img-plus-cont.gif";Img2=imgpath+"/img-folder.gif"
8、;}else{if(IsLast)Img1=imgpath+"/img-branch-end.gif";elseImg1=imgpath+"/img-branch-cont.gif";Img2=imgpath+"/img
此文档下载收益归作者所有