在手风琴窗格内动态创建转发器
我的目标是将 Repeater
嵌套在 ASP.Net AJAX Accordion
的 AccordionPane
中。
因此,我以编程方式向一个 Accordion 添加 AccordionPanes。我添加的窗格数量取决于我的特定数据集的计数值,通常不超过 5。我已经成功地做到了这一点。
我遇到的困难是为每个 AccordionPane 创建并添加一个中继器。
我浏览过 http://iridescent.no/post/Using-Templated- Controls-Programmatically.aspx 但这并不完全是我想要的。相反,我宁愿将单个 Repeater 声明为静态 HTML,然后在需要时可以“克隆”它。我怎样才能实现这个目标?显然,我希望每次“克隆”每个控件的 ID(在此声明的中继器内)时自动生成。
中继器看起来像这样:
<asp:Repeater ID="rptForum" runat="server">
<ItemTemplate>
<div runat="server" style="border:solid #d3d3d3 1px; border-bottom-width:0px;">
<table width="100%">
<tr><td align="left">
<asp:Label runat="server" Font-Size="12px" />
</td></tr>
<tr><td align="left">
>> <asp:Label runat="server" Font-Size="12px" Text='<%# Eval("query") %>' />
</td></tr>
</table>
</div>
</ItemTemplate>
</asp:Repeater>
随着我的进展,我可能会添加更多要进行数据绑定的字段。
任何想法表示赞赏..
My goal is to nest a Repeater
inside an ASP.Net AJAX Accordion
's AccordionPane
.
So there is one Accordion which I am programmatically adding AccordionPanes to. The amount of panes I add depends on my particular dataset's count value, usually no more than 5. I've managed to do this successfully.
The thing I am having difficulty with is creating and adding a Repeater per each AccordionPane.
I've glanced over http://iridescence.no/post/Using-Templated-Controls-Programmatically.aspx but this is not exactly what I had in mind. Instead, I would rather declare a single Repeater as static HTML that I could then "clone" when I need. How can I achieve this? Obviously I would want each control's ID (within this declared Repeater) to be generated automatically each time i "clone" it.
The repeater looks like this:
<asp:Repeater ID="rptForum" runat="server">
<ItemTemplate>
<div runat="server" style="border:solid #d3d3d3 1px; border-bottom-width:0px;">
<table width="100%">
<tr><td align="left">
<asp:Label runat="server" Font-Size="12px" />
</td></tr>
<tr><td align="left">
>> <asp:Label runat="server" Font-Size="12px" Text='<%# Eval("query") %>' />
</td></tr>
</table>
</div>
</ItemTemplate>
</asp:Repeater>
I might add more fields to be databound as I progress.
Any ideas appreciated..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够通过将转发器添加到
Content
模板来做到这一点:You should be able to do that by adding the repeater to the
Content
template:您可以使用手风琴进行分层数据绑定,如下所示: http://aspalliance.com/1674_complex_data_binding_with_the_accordion_control
You can do a hierarchical data bind with the accordion, as illustrated here: http://aspalliance.com/1674_complex_data_binding_with_the_accordion_control