码迷,mamicode.com
首页 > Web开发 > 详细

ASPxTreeList控件去根节点的新增修改操作(写在onCommandColumnButtonInitialize()事件中)

时间:2015-12-27 15:57:29      阅读:524      评论:0      收藏:0      [点我收藏+]

标签:

treelist去掉根节点按钮效果图:

技术分享

技术分享
//去掉父节点及子节点旁的新增、修改、删除操作(写在onCommandColumnButtonInitialize事件中)
protected void Tree_Gooslist_CommandColumnButtonInitialize(object sender, TreeListCommandColumnButtonEventArgs e)
{
if (e.NodeKey != null)
{
TreeListNode node = this.Tree_Gooslist.FindNodeByKeyValue(e.NodeKey.ToString());
if (node.ChildNodes.Count > 0)
{

e.Visible = DevExpress.Utils.DefaultBoolean.False;

}

}

}

 

//只删除父节点旁的新增、修改、删除操作
protected void Tree_Gooslist_CommandColumnButtonInitialize(object sender, TreeListCommandColumnButtonEventArgs e)
{
if (e.NodeKey != null)
{
TreeListNode node = this.Tree_Gooslist.FindNodeByKeyValue(e.NodeKey.ToString());
if (node.Level == 1)
{

e.Visible = DevExpress.Utils.DefaultBoolean.False;

}

}

}

//前端代码:

<dx:ASPxTreeList ID="Tree_Gooslist" AutoGenerateColumns="False" ClientInstanceName="Tree_Gooslist" Width="20%" runat="server" KeyFieldName="cateid" ParentFieldName="parentid" Theme="Mulberry"
OnNodeUpdating="Tree_Gooslist_NodeUpdating" OnNodeDeleting="Tree_Gooslist_NodeDeleting" OnNodeInserting="Tree_Gooslist_NodeInserting" OnCellEditorInitialize="Tree_Gooslist_CellEditorInitialize"
OnNodeValidating="Tree_Gooslist_NodeValidating1" OnHtmlRowPrepared="Tree_Gooslist_HtmlRowPrepared">

<ClientSideEvents Init="TreeNodeClick" FocusedNodeChanged="TreeNodeClick" EndCallback="tree_EndCallback" />
<SettingsPager>
<FirstPageButton Visible="false" />
<LastPageButton Visible="false" />
<NextPageButton Visible="false" />
<PrevPageButton Visible="false" />
<PageSizeItemSettings Visible="false" />

</SettingsPager>

<Styles>
<AlternatingNode BackColor="Yellow">
<Border BorderWidth="0" BorderColor="Transparent" />
</AlternatingNode>
<Header HorizontalAlign="Center"></Header>
<Header CssClass="tw-dtheader" HorizontalAlign="Center"></Header>
<CommandCell CssClass="tw-commandColumn"></CommandCell>
<FocusedNode CssClass="tw-focusRow"></FocusedNode>
<%--<CommandColumn CssClass="tw-commandColumn"></CommandColumn>
<CommandColumnItem CssClass="tw-commandColumnBtn"></CommandColumnItem>
<FocusedRow CssClass="tw-focusRow"></FocusedRow>--%>
</Styles>
<SettingsPopupEditForm Modal="true" HorizontalAlign="WindowCenter" VerticalAlign="WindowCenter" />

<Settings ShowColumnHeaders="true" ShowTreeLines="false" GridLines="Both" />
<SettingsBehavior AllowFocusedNode="true" AllowDragDrop="true" ProcessSelectionChangedOnServer="false" />

<Border BorderWidth="1" BorderColor="Transparent" />
<Columns>
<dx:TreeListDataColumn FieldName="catename" Caption="分类名称" AllowSort="False" Width="10%"></dx:TreeListDataColumn>
<dx:TreeListComboBoxColumn FieldName="pricerange" Caption="价格范围" AllowSort="False" Width="5%"></dx:TreeListComboBoxColumn>
<dx:TreeListComboBoxColumn FieldName="PARENTID" Caption="父id" AllowSort="False" Visible="false" Width="5%"></dx:TreeListComboBoxColumn>
<dx:TreeListComboBoxColumn FieldName="LAYER" Caption="层级" AllowSort="False" Visible="false" Width="5%"></dx:TreeListComboBoxColumn>
<dx:TreeListCommandColumn Caption="功能" Width="5%">

<NewButton Visible="true" Text="[新增]"></NewButton>
<EditButton Visible="true" Text="[修改]"></EditButton>
<DeleteButton Visible="true" Text="[删除]"></DeleteButton>

<%-- <UpdateButton Visible="true" Text="[修改]"></UpdateButton>--%>

<%-- <CustomButtons >
<dx:TreeListCommandColumnCustomButton></dx:TreeListCommandColumnCustomButton>
</CustomButtons>--%>
</dx:TreeListCommandColumn>
</Columns>
View Code

 

ASPxTreeList控件去根节点的新增修改操作(写在onCommandColumnButtonInitialize()事件中)

标签:

原文地址:http://www.cnblogs.com/dfxyw/p/5080074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!