您的位置:首页 > 编程语言 > ASP

ASPxTreeList 的使用心得(第三方控件)

2009-10-20 17:08 330 查看
数据库:sql。效果,做一个树形列表,加上了连接的。(web)

首先,设计,在源里

<dxwtl:ASPxTreeList ID="ASPxTreeList2" runat="server">
<Columns>
<dxwtl:TreeListTextColumn Caption="清华附中" VisibleIndex="0">
<DataCellTemplate>
<dxe:ASPxHyperLink ID="linkDe" runat="server" Text='<%# Eval

("DepartName") %>' Font-Underline="true" NavigateUrl="index.aspx">//这个链接可以随便换成自己要的
</dxe:ASPxHyperLink>
</DataCellTemplate>
</dxwtl:TreeListTextColumn>
</Columns>
</dxwtl:ASPxTreeList>

然后就是绑定数据:

protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
this.MyGetData();
}

}

public void MyGetData()
{
string sSql = @"select DepartId,DepartName ,ParentId from sDepart";//分级显示

DataTable table = CommClass.GetDataTable(sSql);//BoolDAL.DbHelper.GetDataTable

(sSql);

ASPxTreeList2.DataSource = table;
ASPxTreeList2.KeyFieldName = "DepartId";
ASPxTreeList2.ParentFieldName = "ParentId";
//ASPxGridView1.DataBind
ASPxTreeList2.DataBind();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: