【发布时间】:2014-09-20 01:14:38
【问题描述】:
当用户单击结帐时,我想发送一个应该与每个单选按钮关联的 Guid 作为 eventargs。我可以仅使用 RadioButtonList 来实现此功能,但我不能在这里使用它,因为其余字段是从数据库中提取的。
关于这类主题有很多问题,但我找不到一个能准确解决我想要实现的目标的问题。
我有以下列表
<asp:Content ID="SubscriptionContent" ContentPlaceHolderID="MainContent" ViewStateMode="Enabled" runat="server">
<asp:Panel ID="SubscriptionPanel" CssClass="shopping-cart" ViewStateMode="Enabled" runat="server">
<asp:ListView ID="NewSubscription" runat="server">
<LayoutTemplate>
<table class="table">
<thead>
<th>Select a Subscription</th>
<th>Subscription Level
</th>
<th>Description
</th>
<th>Price
</th>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" />
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td class="description"><asp:RadioButton ID="SubscriptionLevel" GroupName="SubscriptionRadio" Text='<%# Eval("SubscriptionLevel") %>' runat="server" /></td>
<td class="description"><asp:Label ID="Details" Text='<%# Eval("Details") %>' runat="server"></asp:Label></td>
<td class="price"><asp:Label runat="server" Text='<%# Eval("Price", "{0:C2}") %>'></asp:Label></td>
<asp:TextBox ID="Id" runat="server" Visible="false" Text='<%# Eval("Id") %>' />
</tr>
</ItemTemplate>
</asp:ListView>
<asp:Button ID="Subscribe" CssClass="btn btn-primary" runat="server" Text="<%$ Snippet: Ecommerce/ShoppingCart/CheckoutButtonLabel, Checkout %>" OnClick="BuySubscription" />
<script type="text/javascript">
$(document).ready(function () {
$("input:radio").attr('name', 'SubscriptionRadio');//Override the naming that asp does
});
</script>
</asp:Panel>
</asp:Content>
我在想,如果我可以使用每个单选按钮的相应 guid 值更新隐藏字段,并在用户触发 BuySubscription 时提交。我不知道该怎么做。最终,我只是希望用户能够选择其中一个订阅选项并将该 guid 传递回函数。
提前感谢您的任何意见。
【问题讨论】:
标签: asp.net