RadControls for ASP.NET Ajax 笔记(1)

RadControls for ASP.NET Ajax 笔记(1)(1)遍历Grid中的所有Item(一行),一次仅展开一行【Singleexpandinhierarchicalgrid】privatevoidRadGrid1_ItemCommand(objectsource,Telerik.Web.UI.GridCommandEventArgse){if(e.CommandName==RadGrid.ExpandCo…

大家好,又见面了,我是你们的朋友全栈君。

(1)遍历Grid中的所有Item(一行),一次仅展开一行【Single expand in hierarchical grid】

private void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if(e.CommandName == RadGrid.ExpandCollapseCommandName)
  {
foreach(GridItem item in e.Item.OwnerTableView.Items)
   {
if(item.Expanded && item != e.Item)
    {
     item.Expanded = false;
    }
   }
  }
}

http://www.telerik.com/help/aspnet-ajax/grdsingleexpandinhierarchicalgrid.html

(2)展开或者折叠所有行

protected void RadGrid1_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e) 

    { 

if (e.CommandName == RadGrid.ExpandCollapseCommandName) 

        { 

            (e.Item.FindControl(“btnExpand”) as ImageButton).Visible = !(e.Item.FindControl(“btnExpand”) as ImageButton).Visible; 

            (e.Item.FindControl(“btnCollapse”) as ImageButton).Visible = !(e.Item.FindControl(“btnCollapse”) as ImageButton).Visible; 

        } 

if (e.CommandName == “ExpandAll”) 

        { 

//Looping through each DataItem and making the “btnExpand” image button in the item visibility  to false and  “btnCollapse” visibility to true 

foreach (GridDataItem GridDataItem in RadGrid1.MasterTableView.GetItems(new GridItemType[] { GridItemType.Item, GridItemType.AlternatingItem })) 

            { 

                ImageButton btnExpand = (ImageButton)GridDataItem.FindControl(“btnExpand”); 

                btnExpand.Visible = false; 

                ImageButton btnCollapse = (ImageButton)GridDataItem.FindControl(“btnCollapse”); 

                btnCollapse.Visible = true; 

            } 

//Exapanding the DataItem

foreach (GridDataItem item in RadGrid1.Items) 

            { 

                item.Expanded = true; 

            } 

//Hiding the CollapseAll image in the header to true and ExpandAll image in the header to false

            GridHeaderItem GridHeaderItem = e.Item as GridHeaderItem; 

            ImageButton imgCollapseAll = (ImageButton)GridHeaderItem.FindControl(“CollapseAll”); 

            imgCollapseAll.Visible = true; 

            ImageButton imgExpandAll = (ImageButton)GridHeaderItem.FindControl(“ExpandAll”); 

            imgExpandAll.Visible = false; 

        } 

if (e.CommandName == “CollapseAll”) 

        { 

//Looping through each DataItem and making the “btnExpand” image button in the item visibility  to true and  “btnCollapse” visibility to false 

foreach (GridDataItem GridDataItem in RadGrid1.MasterTableView.GetItems(new GridItemType[] { GridItemType.Item, GridItemType.AlternatingItem })) 

            { 

                ImageButton btnExpand = (ImageButton)GridDataItem.FindControl(“btnExpand”); 

                btnExpand.Visible = true; 

                ImageButton btnCollapse = (ImageButton)GridDataItem.FindControl(“btnCollapse”); 

                btnCollapse.Visible = false; 

            } 

//Collapsing the DataItem

foreach (GridDataItem item in RadGrid1.Items) 

            { 

                item.Expanded = false; 

            } 

//Hiding the CollapseAll image in the header to false and ExpandAll image in the header to true

            GridHeaderItem GridHeaderItem = e.Item as GridHeaderItem; 

            ImageButton imgCollapseAll = (ImageButton)GridHeaderItem.FindControl(“CollapseAll”); 

            imgCollapseAll.Visible = false; 

            ImageButton imgExpandAll = (ImageButton)GridHeaderItem.FindControl(“ExpandAll”); 

            imgExpandAll.Visible = true; 

        } 

    } 

http://www.telerik.com/community/code-library/aspnet-ajax/grid/custom-expand-collapse-column-with-expandall-collapseall-image-button-in-the-header.aspx

(3)导致Grid重新绑定数据【Commands that invoke Rebind() implicitly】

Here is the complete list of commands that trigger Rebind():

Command Name

Field

ExpandCollapse
RadGrid.ExpandCollapseCommandName

Update
RadGrid.UpdateCommandName

Cancel
RadGrid.CancelCommandName

Delete
RadGrid.DeleteCommandName

Edit
RadGrid.EditCommandName

InitInsert
RadGrid.InitInsertCommandName

PerformInsert
RadGrid.PerformInsertCommandName

RebindGrid
RadGrid.RebindGridCommandName

Page
RadGrid.PageCommandName

Sort
RadGrid.SortCommandName

Filter
RadGrid.FilterCommandName

Note that the following commands do not perform internal rebind:

Select
RadGrid.SelectCommandName

Deselect
RadGrid.DeselectCommandName

http://www.telerik.com/help/aspnet-ajax/grdcommandsthatinvokerebindimplicitly.html

转载于:https://www.cnblogs.com/emanlee/archive/2009/05/30/1492554.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/162001.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • java编程中开头public是什么意思?

    java编程中开头public是什么意思?public关键字是和访问权限相关的,它所修饰的方法对所有类都是可以访问的Java中的访问权限共有四种,它们的作用范围如下图所示:注释:public里的所有类包括:在不同包内也可以访问。default访问权限又叫包访问权限:在这种权限下,可以访问在同一个包中的其他类的成员。…

    2022年7月9日
    25
  • 数据库自动化运维平台–自助DML

    数据库自动化运维平台–自助DML今天介绍下最近开发的一个平台,自助DML。什么是DML,就是平常执行的增删改查数据库操作。有人有疑问这不是程序访问的操作,为什么还要做一个平台操作这些呢,其实这种操作主要是开发需要线下修复数据的一种操作,不只是增删改,还有建表,建索引,添加字段等,这些操作开发一般会提给DBA协助操作数据库。可能你会觉得这些活能有多少,其实这种活真不少,我上家公司是电商互联网公司,大概有七八百个实例,每天的这种操作有近百个。处理近百个这种需求,基本上一个人一天就不用干别的了。虽说现在的公司实例少点,但每天的工作量还是很大,关

    2022年5月17日
    42
  • ACCESS打得开mdb,但打不开表,弹框提示未知错误。

    ACCESS打得开mdb,但打不开表,弹框提示未知错误。

    2021年11月17日
    36
  • 【软件资源】VS2013软件安装全教程!(附VS各版本下载地址)

    【软件资源】VS2013软件安装全教程!(附VS各版本下载地址)VisualStudio(简称VS)是微软公司旗下最重要的软件集成开发工具产品。是目前最流行的Windows平台应用程序开发环境,也是无数人学习编程的入门软件之一。VisualStudio可以用来创建Windows平台下的Windows应用程序和网络应用程序,也可以用来创建网络服务、智能设备应用程序和Office插件,目前还可开发安卓平台应用及IOS平台应用。【软件名称】:VisualStudio2013【安装环境】:Win7/Win8/Win10联网【下载链接】.

    2025年9月1日
    5
  • hashmap线程安全吗 什么解决方案_hashtable为什么是线程安全

    hashmap线程安全吗 什么解决方案_hashtable为什么是线程安全前言该试题从互联网获得,真实性没有考究,加上本人学识浅薄,所以面试题参考为主,解析分享为主。若对解析有不同看法,还请评论指正。谢谢。HashMap为什么不是线程安全?以JDK1.8的HashMap为例,引用作者:一字马胡所写文章中的一张图:上图为…

    2022年9月25日
    2
  • AnyCast技术浅析

    AnyCast技术浅析一常见通信方式1.1UniCastAnyCast1.2MultiCast1.3BroadCast二什么是BGPAnyCast三AnyCast技术特点四AnyCast应用场景4.1场景一:基于IPAnycast+BGP的DNS部署4.2场景二:防范DDOS攻击4.3场景三:大型企业CDN部署4.4场景四:时延敏感度高的内容服务业务五AnyCast总结5.1优点5.2缺点一常见通信方式1.1Un…

    2022年5月24日
    55

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号