如何在asp.net中將標籤值傳遞給c#中的會話變量?如何將標籤值傳遞給c#中的會話變量在asp.net中
的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">
\t <div class="check-sec"> \t
\t \t <div class="col-md-3 cart-total">
\t \t \t <a class="continue" href="Default.aspx">Continue to basket</a>
\t \t \t <div class="price-details">
\t \t \t \t <h3>Price Details</h3>
\t \t \t \t <span>Total</span>
<div class="total">
\t \t \t \t \t <span class="simpleCart_total"></span> </div>
\t \t \t
\t \t \t \t <span>Discount</span>
\t \t \t
<span class="total1">$00.00</span>
\t \t \t \t <span>Delivery Charges</span>
\t \t \t \t
<span class="total1">$00.00(free)</span>
\t \t \t \t <div class="clearfix"></div> \t \t \t \t
\t \t \t </div> \t
\t \t \t <ul class="total_price">
\t \t \t <li class="last_price"> <h4>TOTAL</h4></li> \t
\t \t \t \t
<div class="total">
\t \t \t \t \t <span class="simpleCart_total"></span> </div> \t
\t \t \t </ul>
\t \t \t <div class="clearfix"></div>
\t \t \t <div class="clearfix"></div>
\t \t \t <a class="order" href="Checkoutsignin.aspx">Place Order</a>
\t \t \t
\t \t </div>
\t \t <div class="col-md-9 cart-items">
\t \t \t <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--%>
\t \t \t \t
<%-- This part is close End 07/06/2016--%>
\t \t </div>
\t \t <div class="clearfix"> </div>
\t </div>
</div>
<!-- //check out -->
</asp:Content>
Y您沒有在代碼中將值分配給會話,並且您沒有在代碼中顯示您嘗試讀取該代碼的位置。 –
嘗試 Session [「subtotal」] = subtotal.Text; – Sak
後面的代碼在哪裏? –