如何在asp.net的c#中将标签值传递给会话变量?
subtotal
标签显示了值但未将任何值传递到会话变量:.session["subtotal"]=subtotal.text;
下面我的代码可以帮助#
<%@ Page Title="" Language="C#" MasterPageFile="~/SiteProduct.Master" AutoEventWireup="true" CodeBehind="Checkout.aspx.cs" Inherits="Ecommerce.Checkout" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<!-- check out -->
<div class="container">
<div class="check-sec">
<div class="col-md-3 cart-total">
<a class="continue" href="Default.aspx">Continue to basket</a>
<div class="price-details">
<h3>Price Details</h3>
<span>Total</span>
<div class="total">
<span class="simpleCart_total"></span> </div>
<span>Discount</span>
<span class="total1">$00.00</span>
<span>Delivery Charges</span>
<span class="total1">$00.00(free)</span>
<div class="clearfix"></div>
</div>
<ul class="total_price">
<li class="last_price"> <h4>TOTAL</h4></li>
<div class="total">
<span class="simpleCart_total"></span> </div>
</ul>
<div class="clearfix"></div>
<div class="clearfix"></div>
<a class="order" href="Checkoutsignin.aspx">Place Order</a>
</div>
<div class="col-md-9 cart-items">
<h1>My Shopping Bag </h1>
<%--here cart view start 06/06/2016 --%>
<table style="width:100%;" class="table table-hover">
<ul >
<tr style="width:100%;" >
<td style="width:100%;color:red;background-color:lightblue;margin:10px;display:inline-block;padding:18px;" class="simpleCart_items">
</td>
</tr>
</ul>
<tr >
<td> </td>
<td> </td>
<td> </td>
<td><h5>Subtotal</h5></td>
<td>
<div><asp:Label ID="subtotal" class="simpleCart_total" runat="server"></asp:Label></div>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Estimated shipping</h5></td>
<td><div class="simpleCart_shipping"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h3>Total</h3></td>
<td>
<div id="grandtotal" class="simpleCart_grandTotal"></div>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><a class="order" href="Checkoutsignin.aspx">FinalCheckout</a></td>
<td style="visibility:hidden"> <asp:TextBox ID="myTextBox" runat="server"></asp:TextBox> </td>
</tr>
</table>
<%-- here cart view end 06/06/2016--%>
<%-- This part is close start 07/06/2016--%>
<%-- This part is close End 07/06/2016--%>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- //check out -->
</asp:Content>
答案 0 :(得分:0)
试试这个:
<asp:Label ID="subtotal" Text="SomeText" class="simpleCart_total" runat="server"></asp:Label>
<%Session["subtotal"] = subtotal.Text; %>