转载 关于aspxTreeList的用法 dev treelist

原文地址:关于aspxTreeList的用法作者:叶枫

要求:根据ID来控制ImageButton的显示和隐藏(所有数据加载时进行控制)

.aspx页面

<dxwtl:ASPxTreeList ID="treeListSysModule"runat="server" KeyFieldName="ID"
ParentFieldName="PID" Width="660px"
ClientInstanceName="treeListSysModule"
OnCustomCallback="treeListSysModule_CustomCallback"
OnHtmlDataCellPrepared="treeListSysModule_HtmlDataCellPrepared">
<StylesCell-HorizontalAlign="Left">
<CellHorizontalAlign="Left"></Cell>
</Styles>
<SettingsPager PageSize="20" Mode="ShowPager"></SettingsPager>
<Settings GridLines="Both" />
<Columns>
<dxwtl:TreeListTextColumn Caption="ID"FieldName="ID" VisibleIndex="0"Visible="false"></dxwtl:TreeListTextColumn>
<dxwtl:TreeListTextColumn Caption="系统名称"FieldName="sysname" VisibleIndex="1"></dxwtl:TreeListTextColumn>
<dxwtl:TreeListTextColumn Caption="修改"VisibleIndex="2" >
<DataCellTemplate>
<center>
<asp:ImageButton ID ="imgbtnUpdateWeb" runat="server" ImageUrl="~/Images/img/updateico.gif" AlternateText="修改"CommandArgument ='<%# eval_r("ID")%>' CommandName="update"OnCommand="imgbtnUpdateWeb_Command"/>
</center>
</DataCellTemplate>
</dxwtl:TreeListTextColumn>
<dxwtl:TreeListTextColumn Caption="角色"VisibleIndex="3" >
<DataCellTemplate>
<center>
<asp:ImageButton ID="imgbtnRole"runat="server" AlternateText="角色" ImageUrl="~/Images/img/perm.gif"CommandArgument='<%# eval_r("ID")%>' CommandName="Role"OnCommand="imgbtnRole_Command" />
</center>
</DataCellTemplate>
</dxwtl:TreeListTextColumn>
<dxwtl:TreeListTextColumn Caption="删除"VisibleIndex="4" >
<DataCellTemplate >
<center>
<asp:ImageButton ID="imgbtnDelete"runat="server" ImageUrl="~/Images/img/delete.gif"OnClientClick="return confirm('你确定要删除此记录吗?');" AlternateText="删除"CommandArgument='<%# eval_r("ID") %>'CommandName="De"OnCommand="imgbtnDelete_Command"/>
</center>
</DataCellTemplate>
</dxwtl:TreeListTextColumn>
</Columns>
</dxwtl:ASPxTreeList>

.cs文件

using DevExpress.Web.ASPxTreeList;

///<summary>
///控制修改、角色、删除按钮
///</summary>
///<paramname="sender"></param>
///<paramname="e"></param>
protectedvoid treeListSysModule_HtmlDataCellPrepared(object sender,DevExpress.Web.ASPxTreeList.TreeListHtmlDataCellEventArgs e)
{
if (e.NodeKey.Substring(e.NodeKey.Length - 3, 3) == "000")
{
ImageButton imgUpdate =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[2] as TreeListDataColumn,"imgbtnUpdateWeb") as ImageButton;
ImageButton imgRole =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[3] as TreeListDataColumn, "imgbtnRole")as ImageButton;
ImageButton imgDelete =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[4] as TreeListDataColumn, "imgbtnDelete")as ImageButton;
imgUpdate.Visible = false;
imgRole.Visible = false;
imgDelete.Visible = false;
}
else
{
ImageButton imgUpdate =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[2] as TreeListDataColumn,"imgbtnUpdateWeb") as ImageButton;
ImageButton imgRole =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[3] as TreeListDataColumn, "imgbtnRole")as ImageButton;
ImageButton imgDelete =treeListSysModule.FindDataCellTemplateControl(e.NodeKey,treeListSysModule.Columns[4] as TreeListDataColumn, "imgbtnDelete")as ImageButton;
imgRole.Visible = true;
imgDelete.Visible = true;
imgUpdate.Visible = true;
}

注:e.NodeKey就是页面绑定的主键ID。

  

爱华网本文地址 » http://www.413yy.cn/a/25101010/29577.html

更多阅读

转载 关于BOLL-M和BBIBOLL在实战中的比对秋实原创系列 王秋实

原文地址:关于BOLL-M和BBIBOLL在实战中的比对(秋实原创系列)作者:秋实一般平时常用指标BOLL-M布林线-主图叠加指标和BBIBOLL多空指标BBI和布林线叠加比对来分析股票,而且盘中30分钟比较有效,特别是对于BBIBOLL的观察有些心得。BBIBOLL的用

诗中雪转载关于雪的古诗 关于雪景的古诗

诗中雪1.草枯鹰眼急,雪尽马蹄轻。(王维:《观猎》)2.欲将轻骑逐,大雪满弓刀。(卢纶:《塞下曲》)3.遥知不是雪,为有暗香来。(王安石:《梅花》)4.孤舟蓑笠翁,独钓寒江雪。(柳宗元:《江雪》)5.柴门闻犬吠,风雪夜归人。(刘长卿:《逢雪宿芙蓉山主人))6.青

转载 金刚铃杵的用法,金刚铃杵:三宝所依的胜义菩提心的精义

原文地址:金刚铃杵的用法,金刚铃杵:三宝所依的胜义菩提心的精义作者:日月明空曌无我很多人虽知道金刚铃杵是不可缺少的两个法器,但多数人只将它当作平平常常的用品,而不认为是三宝所依。两者在一起,象征著智慧及方便原是无二的,这也就是胜

声明:《转载 关于aspxTreeList的用法 dev treelist》为网友不在服务区分享!如侵犯到您的合法权益请联系我们删除