ASPxTreeList应该是比较长用的控件了~现在就来说说它的右键按钮事件
这里实现的是右键里有折合和展开所有节点的功能
code:
1 <dx:ASPxTreeList ID="ASPxTreeList2" ClientInstanceName="treelist1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="400px" KeyFieldName="id" ParentFieldName="parent_id" Width="200px" OnHtmlDataCellPrepared="ASPxTreeList2_HtmlDataCellPrepared" OnHtmlRowPrepared="ASPxTreeList2_HtmlRowPrepared">
<Columns> 3 <dx:TreeListTextColumn FieldName="child_id" Visible="False" VisibleIndex="0"> 4 </dx:TreeListTextColumn> 5 <dx:TreeListTextColumn Caption="后台管理" FieldName="name" VisibleIndex="1" Name="name"> 6 </dx:TreeListTextColumn> 7 <dx:TreeListTextColumn FieldName="id" Visible="False" VisibleIndex="2"> 8 </dx:TreeListTextColumn> 9 <dx:TreeListTextColumn FieldName="parent_id" Visible="False" VisibleIndex="3"> 10 </dx:TreeListTextColumn> 11 </Columns> 12 <Settings ShowTreeLines="False" /> 13 <SettingsBehavior AllowDragDrop="False" AllowFocusedNode="True" AllowSort="False" AutoExpandAllNodes="True" /> 14 <%--<Images SpriteImageUrl="/image/backgroud3.jpg"> 15 </Images>--%> 16 <SettingsCustomizationWindow Enabled="True" /> 17 <Images SpriteImageUrl="/image/backgroud1.jpg"> 18 </Images> 19 <ClientSideEvents ContextMenu="function(s, e) { 20 if(e.objectType == "Node") 21 { 22 rightmenu.ShowAtPos(ASPxClientUtils.GetEventX(e.htmlEvent), 23 ASPxClientUtils.GetEventY(e.htmlEvent)); 24 } 25 }" /> 26 <BackgroundImage ImageUrl="/image/backgroud3.jpg" /> 27 28 </dx:ASPxTreeList>