我有一个转发器并绑定它。但我想显示前10项模板,当点击展开按钮显示所有项目模板。 我想使用Bootstrap和JavaScript。
源代码:转发器
<asp:Repeater ID="MoreBrandSelectionRepeater" runat="server">
<ItemTemplate>
<div style="color: rgb(0, 83, 167)" class="row collapse in" id="demo">
<div class="col-xs-6">
<label style="font-style: normal; text-decoration: none; font-weight: 100; cursor: pointer">
<asp:CheckBox AutoPostBack="true" ID="BrandCheckBox" name='<%#"Brand-"+Eval("ebrand") %>' runat="server" OnCheckedChanged="BrandCheckBox_CheckedChanged" />
<%#(Eval("fbrand")) %>
</label>
<asp:Label Visible="false" Text='<%#Eval("ebrand")%>' ID="BrandLabel" runat="server" />
</div>
<div class="col-xs-6 text-left">
<%#(Eval("ebrand")) %>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
<button type="button" id="expand Button" class="btn btn-primary" runat="server" data-toggle="collapse" data-target="#demo">
<span class="glyphicon glyphicon-collapse-down"></span>کمتر
</button>
</FooterTemplate>
</asp:Repeater>
代码背后:转发器绑定
SqlDataAdapter daBrand = new SqlDataAdapter("Select distinct top(10) RTRIM(LTRIM(Substring(brand,0,CharIndex(N'#',brand)))) as fBrand, RTRIM(LTRIM(Substring(brand,CharIndex(N'#',brand)+1,(len(brand)-CharIndex(N'#',brand))))) as eBrand from product WHERE ([Cat" + catLevel + "] = N'" + destName + "' )", con);
DataTable dtBrand = new DataTable();
daBrand.Fill(dtBrand);
BrandSelectionRepeater.DataSource = dtBrand;
BrandSelectionRepeater.DataBind();
当我点击按钮显示所有项目时,当转发器项目模板超过10时,我只有10个项目。
请帮帮我。