本文介绍了使用Ajax手风琴与直放站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Repeater控件,现在想将它添加到手风琴。它不似乎工作。我怎么能去这样做?

我的中继器:

 < ajaxToolkit:手风琴ID =accordion1=服务器的CssClass =手风琴HeaderCssClass =accordionHeader
    HeaderSelectedCssClass =accordionHeaderSelectedContentCssClass =accordionContent
    自动调整大小=无FadeTransitions =真TransitionDuration =250FramesPerSecond =40
    RequireOpenedPane =假燮pressHeaderPostbacks =真正的>
        <&窗格GT;
            < ASP:直放站ID =Repeater1=服务器的DataSourceID =SchemeDataSource1>
                <&ItemTemplate中GT;
                    <表样式=边界:细实#000000;颜色:黑色;背景颜色:#E0E0E0宽度:100%>
                            &所述; TR>
                                &所述; TD>
                                    < ajaxToolkit:AccordionPane ID =AccordionPane1=服务器>
                                        <页眉和GT;
                                            preNO
                                            < ASP:标签ID =LBL preNO=服务器文本='<%#绑定(preNR)%>'>< / ASP:标签>
                                            月刊preMIUM
                                            < ASP:标签ID =LBL $ P $点=服务器文本='<%#绑定(preMIUM)%>'>< / ASP:标签>
                                            < BR />
                                            < ASP:LinkBut​​ton的ID =LNK pre=服务器工具提示=复制premium新方案FONT-粗体=真
                                                FONT-SIZE =较大可见=真>>>
                                            < / ASP:LinkBut​​ton的>
                                            < BR />
                                            关系: [
                                            < ASP:标签ID =lblRel=服务器文本='<%#绑定(关系)%GT;'>< / ASP:标签>
                                            ] UW code:
                                            < ASP:标签ID =lblUw=服务器文本='<%#绑定(UWFEE code)%>'>< / ASP:标签>
                                            ] [
                                            < ASP:标签ID =lblUwDescription=服务器文本='<%#绑定(说明)%GT;'>< / ASP:标签>
                                            ]
                                            < BR />
                                        < /页眉和GT;
                                        <内容>
                                            <表>
                                                < TR align =leftVALIGN =顶>
                                                    < TD align =left>
                                                        < ASP:DetailsView控件ID =dvEarner=服务器的HeaderText =NO EARNEREmptyDataText =显示任何结果
                                                            HeaderStyle-BORDERCOLOR =黑HeaderStyle-边框样式=实HeaderStyle-边框宽度=1像素
                                                            背景色=#DEBA84BORDERCOLOR =#DEBA84边框=无边框宽度=1像素
                                                            CELLPADDING =3CELLSPACING =2的EnableViewState =假>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < PagerStyle前景色=#8C4510Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                        < / ASP:DetailsView控件>
                                                    < / TD>
                                                    < TD align =left>
                                                        < ASP:DetailsView控件ID =dvJVName=服务器的HeaderText =JV NAMEHeaderStyle-BORDERCOLOR =黑
                                                            HeaderStyle-边框样式=实HeaderStyle-边框宽度=1px的EmptyDataText =JV NAME
                                                            AlternatingRowStyle-边框样式=实AlternatingRowStyle-边框宽度=1像素
                                                            背景色=#DEBA84BORDERCOLOR =#DEBA84边框=无边框宽度=1像素
                                                            CELLPADDING =3CELLSPACING =2>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < PagerStyle前景色=#8C4510Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < EmptyDataRowStyle背景色=#5D7B9D前景色=白字体粗体=真/>
                                                        < / ASP:DetailsView控件>
                                                    < / TD>
                                                    < TD align =left>
                                                        < ASP:DetailsView控件ID =DetailsView1=服务器的HeaderText =%HeaderStyle-BORDERCOLOR =黑
                                                            HeaderStyle-边框样式=实HeaderStyle-边框宽度=1px的EmptyDataText =%
                                                            AlternatingRowStyle-边框样式=实AlternatingRowStyle-边框宽度=1像素
                                                            背景色=#DEBA84BORDERCOLOR =#DEBA84边框=无边框宽度=1像素
                                                            CELLPADDING =3CELLSPACING =2>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < PagerStyle前景色=#8C4510Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < EditRowStyle背景色=#738A9CFONT-粗体=真前景色=白/>
                                                            < EmptyDataRowStyle背景色=#5D7B9D前景色=白字体粗体=真/>
                                                        < / ASP:DetailsView控件>
                                                    < / TD>
                                                    < TD align =left>
                                                        < ASP:DetailsView控件ID =dvProduct=服务器的HeaderText =产品信息HeaderStyle-BORDERCOLOR =黑
                                                            HeaderStyle-边框样式=实HeaderStyle-边框宽度=1px的EmptyDataText =显示任何结果
                                                            AlternatingRowStyle-边框样式=实AlternatingRowStyle-边框宽度=1像素
                                                            背景色=#DEBA84BORDERCOLOR =#DEBA84边框=无边框宽度=1像素
                                                            CELLPADDING =3CELLSPACING =2>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < PagerStyle前景色=#8C4510Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                        < / ASP:DetailsView控件>
                                                    < / TD>
                                                    < TD align =left>
                                                        < ASP:DetailsView控件ID =dvFeeDetails=服务器的HeaderText =其他费用详情
                                                            HeaderStyle-BORDERCOLOR =黑HeaderStyle-边框样式=实HeaderStyle-边框宽度=1像素
                                                            EmptyDataText =显示任何结果AlternatingRowStyle-边框样式=实
                                                            AlternatingRowStyle-边框宽度=1px的背景色=#DEBA84BORDERCOLOR =#DEBA84
                                                            边框样式=无边框宽度=1px的CELLPADDING =3CELLSPACING =2>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < PagerStyle前景色=#8C4510Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                        < / ASP:DetailsView控件>
                                                        < BR />
                                                    < / TD>
                                                < / TR>
                                            < /表>
                                            <表>
                                                &所述; TR>
                                                    &所述; TD>
                                                        <强>< U>主承销商联系方式:LT; / U>< / STRONG>
                                                        < ASP:GridView控件ID =grdUWDetails=服务器前景色=#333333CELLPADDING =4
                                                            AutoGenerateSelectButton =FALSE>
                                                            < RowStyle的BackColor =#F7F6F3前景色=#333333/>
                                                            < FooterStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < PagerStyle背景色=#284775前景色=白Horizo​​ntalAlign =中心/>
                                                            < HeaderStyle背景色=#5D7B9DFONT-粗体=真前景色=白/>
                                                            < EmptyDataTemplate>
                                                                显示没有结果< / EmptyDataTemplate>
                                                        < / ASP:GridView的>
                                                        < BR />
                                                        <小时/>
                                                    < / TD>
                                                < / TR>
                                            < /表>
                                        < /内容及GT;
                                    < / ajaxToolkit:AccordionPane>
                                < / TD>
                            < / TR>
                        < /表>
                < / ItemTemplate中>
            < / ASP:直放站>
        < /窗格>
    < / ajaxToolkit:手风琴>

直放站产品的约束:

 私人小组Repeater1_ItemDataBound(BYVAL发件人为对象,BYVAL E上System.Web.UI.WebControls.RepeaterItemEventArgs)处理Repeater1.ItemDataBound
如果e.Item.ItemType = ListItemType.Item OrElse运算e.Item.ItemType = ListItemType.AlternatingItem然后
  昏暗的STR preNO的String = DirectCast(e.Item.FindControl(LBL preNO),标签)。文本  昏暗的DV作为DetailsView控件= DirectCast(e.Item.FindControl(dvEarner),DetailsView控件)
  dv.DataSource = fnLoad premiums(STR preNO)
  dv.DataBind()  昏暗的DV1由于DetailsView控件= DirectCast(e.Item.FindControl(dvProduct),DetailsView控件)
  dv1.DataSource = fnLoadProduct(STR preNO)
  dv1.DataBind()  昏暗的DV2作为DetailsView控件= DirectCast(e.Item.FindControl(dvFeeDetails),DetailsView控件)
  dv2.DataSource = fnLoadFeeDetails(STR preNO)
  dv2.DataBind()  昏暗的GRD作为GridView控件= DirectCast(e.Item.FindControl(grdUWDetails),GridView控件)  grd.DataSource = fnLoadGrid(STR preNO)
  grd.DataBind()
万一
结束小组


解决方案

来解决,这是通过动态地添加我的手风琴的唯一途径,并通过code中的AccordionPanes后面。

HTML

 < ajaxToolkit:手风琴ID =MainAccordion1=服务器的CssClass =手风琴HeaderCssClass =accordionHeader
        HeaderSelectedCssClass =accordionHeaderSelectedContentCssClass =accordionContent
        自动调整大小=无FadeTransitions =真TransitionDuration =250FramesPerSecond =40
        RequireOpenedPane =假燮pressHeaderPostbacks =真正的>
        <&窗格GT;        < /窗格>
< / ajaxToolkit:手风琴>

code背后:

 '创建AccrionPane
昏暗的面板作为新AjaxControlToolkit.AccordionPane
pane.ID =窗格中的&放大器;一世
pane.HeaderContainer.Controls.Add(headerLabel1)
pane.HeaderContainer.Controls.Add(headerLabel2)Me.MainAccordion1.Panes.Add(窗格)

我通过我的数据源,在我Accrordion迭代,并填充数据

I have a Repeater control and now want to add it to an Accordion. It doesn't seems to work. How can I go about doing this?

My Repeater:

<ajaxToolkit:Accordion ID="accordion1" runat="server" CssClass="accordion" HeaderCssClass="accordionHeader"
    HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
    AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"
    RequireOpenedPane="false" SuppressHeaderPostbacks="true">
        <Panes>
            <asp:Repeater ID="Repeater1" runat="server"  DataSourceID="SchemeDataSource1">
                <ItemTemplate>
                    <table style="border: thin solid #000000;color: Black;background-color:#E0E0E0"; width: "100%" >
                            <tr>
                                <td>
                                    <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
                                        <Header>
                                            PRENO
                                            <asp:Label ID="lblPreno" runat="server" Text='<%# Bind("PRENR") %>'></asp:Label>
                                            MONTHLY PREMIUM
                                            <asp:Label ID="lblPrem" runat="server" Text='<%# Bind("PREMIUM") %>'></asp:Label>
                                            <br />
                                            <asp:LinkButton ID="lnkPre" runat="server" ToolTip="Copy Premium To New Scheme" Font-Bold="True"
                                                Font-Size="Larger" Visible="true">>>
                                            </asp:LinkButton>
                                            <br />
                                            Relation: [
                                            <asp:Label ID="lblRel" runat="server" Text='<%# Bind("RELATION") %>'></asp:Label>
                                            ] UWCODE: [
                                            <asp:Label ID="lblUw" runat="server" Text='<%# Bind("UWFEECODE") %>'></asp:Label>
                                            ][
                                            <asp:Label ID="lblUwDescription" runat="server" Text='<%# Bind("DESCRIPTION") %>'></asp:Label>
                                            ]
                                            <br />
                                        </Header>
                                        <Content>
                                            <table>
                                                <tr align="left" valign="top">
                                                    <td align="left">
                                                        <asp:DetailsView ID="dvEarner" runat="server" HeaderText="NO EARNER" EmptyDataText="No Results To Display"
                                                            HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
                                                            CellPadding="3" CellSpacing="2" EnableViewState="False">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                        </asp:DetailsView>
                                                    </td>
                                                    <td align="left">
                                                        <asp:DetailsView ID="dvJVName" runat="server" HeaderText="JV NAME" HeaderStyle-BorderColor="Black"
                                                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px" EmptyDataText="JV NAME"
                                                            AlternatingRowStyle-BorderStyle="Solid" AlternatingRowStyle-BorderWidth="1px"
                                                            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
                                                            CellPadding="3" CellSpacing="2">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <EmptyDataRowStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="true" />
                                                        </asp:DetailsView>
                                                    </td>
                                                    <td align="left">
                                                        <asp:DetailsView ID="DetailsView1" runat="server" HeaderText="%" HeaderStyle-BorderColor="Black"
                                                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px" EmptyDataText="%"
                                                            AlternatingRowStyle-BorderStyle="Solid" AlternatingRowStyle-BorderWidth="1px"
                                                            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
                                                            CellPadding="3" CellSpacing="2">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                                                            <EmptyDataRowStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="true" />
                                                        </asp:DetailsView>
                                                    </td>
                                                    <td align="left">
                                                        <asp:DetailsView ID="dvProduct" runat="server" HeaderText="PRODUCT DETAILS" HeaderStyle-BorderColor="Black"
                                                            HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px" EmptyDataText="No Results To Display"
                                                            AlternatingRowStyle-BorderStyle="Solid" AlternatingRowStyle-BorderWidth="1px"
                                                            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
                                                            CellPadding="3" CellSpacing="2">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                        </asp:DetailsView>
                                                    </td>
                                                    <td align="left">
                                                        <asp:DetailsView ID="dvFeeDetails" runat="server" HeaderText="ADDITIONAL FEE DETAILS"
                                                            HeaderStyle-BorderColor="Black" HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                            EmptyDataText="No Results To Display" AlternatingRowStyle-BorderStyle="Solid"
                                                            AlternatingRowStyle-BorderWidth="1px" BackColor="#DEBA84" BorderColor="#DEBA84"
                                                            BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                        </asp:DetailsView>
                                                        <br />
                                                    </td>
                                                </tr>
                                            </table>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <strong><u>UNDERWRITER DETAILS:</u></strong>
                                                        <asp:GridView ID="grdUWDetails" runat="server" ForeColor="#333333" CellPadding="4"
                                                            AutoGenerateSelectButton="False">
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <EmptyDataTemplate>
                                                                No results to display.</EmptyDataTemplate>
                                                        </asp:GridView>
                                                        <br />
                                                        <hr />
                                                    </td>
                                                </tr>
                                            </table>
                                        </Content>
                                    </ajaxToolkit:AccordionPane>
                                </td>
                            </tr>                                                  
                        </table>
                </ItemTemplate>
            </asp:Repeater>
        </Panes>
    </ajaxToolkit:Accordion>

Repeater Item Bound:

Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
  Dim strPreno As String = DirectCast(e.Item.FindControl("lblPreno"), Label).Text

  Dim dv As DetailsView = DirectCast(e.Item.FindControl("dvEarner"), DetailsView)
  dv.DataSource = fnLoadPremiums(strPreno)
  dv.DataBind()

  Dim dv1 As DetailsView = DirectCast(e.Item.FindControl("dvProduct"), DetailsView)
  dv1.DataSource = fnLoadProduct(strPreno)
  dv1.DataBind()

  Dim dv2 As DetailsView = DirectCast(e.Item.FindControl("dvFeeDetails"), DetailsView)
  dv2.DataSource = fnLoadFeeDetails(strPreno)
  dv2.DataBind()

  Dim grd As GridView = DirectCast(e.Item.FindControl("grdUWDetails"), GridView)

  grd.DataSource = fnLoadGrid(strPreno)
  grd.DataBind()
End If
End Sub
解决方案

The only way to solve this was by adding my Accordion dynamically and the AccordionPanes through code behind.

HTML:

<ajaxToolkit:Accordion ID="MainAccordion1" runat="server" CssClass="accordion" HeaderCssClass="accordionHeader"
        HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
        AutoSize="None" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40"
        RequireOpenedPane="false" SuppressHeaderPostbacks="true">
        <Panes>

        </Panes>
</ajaxToolkit:Accordion>

Code Behind:

'Create AccrionPane
Dim pane As New AjaxControlToolkit.AccordionPane
pane.ID = "pane" & i
pane.HeaderContainer.Controls.Add(headerLabel1)
pane.HeaderContainer.Controls.Add(headerLabel2)

Me.MainAccordion1.Panes.Add(pane)

I iterate through my datasource and populate the data in my Accrordion

这篇关于使用Ajax手风琴与直放站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:27