惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
F
Fortinet All Blogs
J
Java Code Geeks
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
M
MIT News - Artificial intelligence
腾讯CDC
Last Week in AI
Last Week in AI
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
博客园 - 叶小钗
Recent Announcements
Recent Announcements
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
L
LangChain Blog
博客园 - 司徒正美
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - 大厨师

DotNetNuke发布6.0版,开发语言改为C# 通过URL直接传递参数给报表服务中汉字的处理 重复文件整理 DotNetNuke 4/5 安装提示 msajax错误,下载AJAX 1.0即可解决 - 大厨师 siverlisht测试版上开发的应用程序因为和正式版兼容问题不能访问 Oracle数据库使用遇到问题记录 今天接到了微软公司最恶心的推销电话 还在为页面的兼容性苦恼? DotNetNuke模块开发简介 DotNetNuke 4.6.2 中文安装包及代码--重新做人 DotNetNuke 04.05.05 安装 卡巴司机能占多大地方? 微软推出中文版70-431,70-500考试 你能把百度搜成这样吗? 做技术的不如做广告的,还是做广告的侮辱做技术的? 关注MSDN图书中心,关注读书时代 Win2000 Win2003安装卡巴斯基6.0 微软再次发布正版验证更新 Ajax 水印文本框
Ajax 学习,Accordion
大厨师 · 2007-03-31 · via 博客园 - 大厨师

Accordion可以包括多个Pane,每次显示一个,其他的pane折叠起来。Accordion中包含多个Accordionpane来实现其功能。

每个accordionpane包含使用模版的标题和内容。Seleced属性保证postback之后,仍然使展开的pane可见。

The Accordion is a web control that allows you to provide multiple panes and display them one at a time. It is like having several CollapsiblePanels where only one can be expanded at a time. The Accordion is implemented as a web control that contains AccordionPane web controls. Each AccordionPane control has a template for its Header and its Content. We keep track of the selected pane so it stays visible across postbacks.

It also supports three AutoSize modes so it can fit in a variety of layouts.

AutoSize属性,None 无限制,可能导致页面其他部分因为Accordion大小的改变而移动;Limit 受限的,accordion不会超过指定的Height,如果内容太多pane会显示滚动条;Fill 固定大小,内容放大或缩小到指定的大小。

  • None - The Accordion grows/shrinks without restriction. This can cause other elements on your page to move up and down with it.
  • Limit - The Accordion never grows larger than the value specified by its Height property. This will cause the content to scroll if it is too large to be displayed.
  • Fill - The Accordion always stays the exact same size as its Height property. This will cause the content to be expanded or shrunk if it isn't the right size.

The Accordion is written using an extender like most of the other extenders in the AJAX Control Toolkit. The extender expects its input in a very specific hierarchy of container elements (like divs), so the Accordion and AccordionPane web controls are used to generate the expected input for the extender. The extender can also be used on its own if you provide it appropriate input.

The Accordion can also be databound. Simply specify a data source through the DataSource or DataSourceID properties and then set your data items in the HeaderTemplate and ContentTemplate properties.

Accordion可以使用数据绑定。指定DataSource 或者 DataSourceID 属性,然后设置HeaderTemplate 和ContentTemplate即可。

<ajaxToolkit:Accordion
    ID="MyAccordion"
    runat="Server"
    SelectedIndex="0"
    HeaderCssClass="accordionHeader"
    ContentCssClass="accordionContent"
    AutoSize="None"
    FadeTransitions="true"
    TransitionDuration="250"
    FramesPerSecond="40"
    RequireOpenedPane="false"
    SuppressHeaderPostbacks="true">
    <Panes>
        <ajaxToolkit:AccordionPane
            HeaderCssClass="accordionHeader"
            ContentCssClass="accordionContent">
            <Header> . . . </Header>
            <Content> . . . </Content>
        </ajaxToolkit:AccordionPane>        
        .
        .
        .
    </Panes>            
    <HeaderTemplate>...</HeaderTemplate>
    <ContentTemplate>...</ContentTemplate>
</ajaxToolkit:Accordion>
  • SelectedIndex - The AccordionPane to be initially visible
  • HeaderCssClass - Name of the CSS class to use for the headers. This can be either applied to the Accordion as a default for all AccordionPanes, or an individual AccordionPane.
  • ContentCssClass - Name of the CSS class to use for the content. This can be either applied to the Accordion as a default for all AccordionPanes, or an individual AccordionPane.
  • FadeTransitions - True to use the fading transition effect, false for standard transitions.
  • TransitionDuration - Number of milliseconds to animate the transitions
  • FramesPerSecond - Number of frames per second used in the transition animations
  • AutoSize - Restrict the growth of the Accordion. The values of the AutoSize enumeration are described above.
  • RequireOpenedPane - Prevent closing the currently opened pane when its header is clicked (which ensures one pane is always open). The default value is true.
  • SuppressHeaderPostbacks - Prevent the client-side click handlers of elements inside a header from firing (this is especially useful when you want to include hyperlinks in your headers for accessibility)
  • Panes - Collection of AccordionPane controls
  • HeaderTemplate - The Header template contains the markup that should be used for an pane's header when databinding
  • ContentTemplate - The Content template contains the markup that should be used for a pane's content when databinding
  • DataSource - The data source to use. DataBind() must be called.
  • DataSourceID - The ID of the data source to use.
  • DataMember - The member to bind to when using a DataSourceID