获取嵌套转发器中复选框所选项目的计数。 [英] Getting the count of the checkbox selected items inside a nested repeater.
问题描述
我在已经在另一个转发器中的转发器内使用Checkbox ..我想计算每个类别中复选框的选定项目。
果汁(任何2) - >中继器
*芒果汁
* Apple Juice - >复选框
*橙汁
摇(任意2) - >中继器
* Apple摇晃
* Chikku摇 - >复选框
*橙摇晃
我想根据转发器中给出的限制检查所选的复选框项目。我应该怎么做...我已经使用了一个复选框列表而不是转发器和chechboxes但它不能正常工作....我怎么能解决这个问题。
< asp:Repeater < span class =code-attribute> runat = server ID = rptCategories < span class =code-attribute> onitemcommand = rptCategories_ItemCommand >
< < span class =code-leadattribute> HeaderTemplate >
< / HeaderTemplate >
< ItemTemplate >
< a id =' <%#DataBinder .Eval(Container.DataItem, CategoryId)% > ' > < / a > < strong >
< asp:Literal < span class =code-attribute> ID = litCatName runat = server 文字 =' <%#DataBinder.Eval(Container.DataItem, CategoryName)%> ' > < / asp :Literal > < / strong >
(任何< asp:Literal ID = litQuantity runat < span class =code-keyword> = server 文本 =' <% #DataBinder.Eval(Container.DataItem, Qu antity)%> ' > < / asp:Literal > )
< / td >
< / tr >
< asp:Repeater runat = server ID = rptMenuItemsInCategory DataSource =' <%#System.Data.DataRowView)容器。数据项)。 Row.GetChildRows( CategoryToMenu)%> ' OnItemCommand = rptMenuItemsInCategory_ItemCommand > ;
< HeaderTemplate >
< / HeaderTemplate >
< ItemTemplate >
< asp:CheckBox ID = Chkmenu runat = server OnCheckedChanged = Chkmenu_checkchanged AutoPostBack = true / >
< asp:标签 ID = lblitemname runat = 服务器 文字 =' <%#DataBinder.Eval(Container.DataItem, [\ItemName \])%> ' > < / asp:Label >
< asp:HiddenField ID = hidmenuid runat = server 值 =' <% #DataBinder.Eval(Container.DataItem, [\MenuId \])%> ' / >
< asp:HiddenField ID = < span class =code-keyword> hidCatname runat = server 值 =' <%#DataBinder .Eval(Container.DataItem, [\CategoryName \])%> ' / >
< asp:HiddenField ID = hidCatId runat = server 值 =' <%#DataBinder.Eval(Container.DataItem, [\CategoryId \])%> ' / >
< / ItemTemplate >
< span class =code-keyword>< FooterTemplate >
< / FooterTemplate >
< / asp:Repeater > < / table >
< / td >
< / tr >
< / ItemTemplate >
< FooterTemplate >
< / table >
< / FooterTemplate > ;
< / asp:Repeater >
您好
以下链接可以帮助您。
http://www.sitepoint.com/forums/showthread.php?390324-ASP-NET-Accessing-TextBox-value-within-a-nested-repeater [<一个href =http://www.sitepoint.com/forums/showthread.php?390324-ASP-NET-Accessing-TextBox-value-within-a-nested-repeatertarget =_ blanktitle =New Window > ^ ]
I am using Checkbox inside a repeater which is already inside another repeater..I want to count the selected items of the check boxes in each category.
Juice(Any 2) --> repeater
* Mango juice
* Apple Juice ->checkbox
* Orange Juice
Shake (Any 2)-->repeater
* Apple shake
* Chikku shake ->checkbox
* Orange Shake
I want to check the selected checkbox items according to the limitation given in the repeater. what should i do...i already used one checkbox list instead of the repeater and chechboxes but it is not working....How can i solve this.
<asp:Repeater runat="server" ID="rptCategories" onitemcommand="rptCategories_ItemCommand" >
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<a id='<%# DataBinder.Eval(Container.DataItem, "CategoryId")%>' ></a><strong>
<asp:Literal ID="litCatName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CategoryName")%>'></asp:Literal> </strong>
(Any <asp:Literal ID="litQuantity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity")%>'></asp:Literal>)
</td>
</tr>
<asp:Repeater runat="server" ID="rptMenuItemsInCategory" DataSource='<%# System.Data.DataRowView)Container.DataItem). Row.GetChildRows("CategoryToMenu") %>' OnItemCommand="rptMenuItemsInCategory_ItemCommand" >
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="Chkmenu" runat="server" OnCheckedChanged="Chkmenu_checkchanged" AutoPostBack="true" />
<asp:Label ID="lblitemname" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "[\"ItemName\"]")%>'></asp:Label>
<asp:HiddenField ID="hidmenuid" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "[\"MenuId\"]")%>' />
<asp:HiddenField ID="hidCatname" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "[\"CategoryName\"]")%>' />
<asp:HiddenField ID="hidCatId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "[\"CategoryId\"]")%>' />
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater> </table>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
Hi
The following link may help you .
http://www.sitepoint.com/forums/showthread.php?390324-ASP-NET-Accessing-TextBox-value-within-a-nested-repeater[^]
这篇关于获取嵌套转发器中复选框所选项目的计数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!