zoukankan      html  css  js  c++  java
  • ASPxTreeList的右键按钮事件

    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 == &quot;Node&quot;) 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>
    <dx:ASPxPopupMenu runat="server" ID="rightmenu1" ClientInstanceName ="rightmenu" EnableTheming="True" Theme="PlasticBlue">
                        <ClientSideEvents ItemClick="function(s, e) {
        if(e.item.name==&quot;expandall&quot;)
        {    treelist1.ExpandAll();
            return;
        }
        if(e.item.name==&quot;collapseall&quot;)
        {
            treelist1.CollapseAll();
            return;
        }
    } " />
              <Items>
                   <dx:MenuItem Name="expandall" Text="展开所有"></dx:MenuItem>
                   <dx:MenuItem Name="collapseall" Text="关闭所有"></dx:MenuItem>
              </Items>
     </dx:ASPxPopupMenu>
    年轻过得闲,以后被人嫌... 年轻累不死....
  • 相关阅读:
    C#日期加减
    c#的预编译指令
    IHttpModule与IHttpHandler的区别整理
    ASP.NET提供程序
    在所有页面共享通用行为
    5.Oracle中的数据表
    asp.net跳转页面的三种方法比较(转)
    C#实现经典排序算法
    ASP.NET用户登录模块代码
    http错误锦集
  • 原文地址:https://www.cnblogs.com/hrx-star/p/3162123.html
Copyright © 2011-2022 走看看