我似乎不能把我的变量传递到下一页。有人能告诉我我做错了什么吗?
var finalValue = value * sqlCouponValue;
finalValue = Math.Round(finalValue, 2);
Session["discountedOrderTotal"] = finalValue.ToString();我试着在下一页上再把它叫做:
e.Row.Cells[4].Text = "$" + Session["discountOrderTotal"];有人有什么想法吗?我以前从未使用过会话变量,也不知道为什么它只是返回一个$。任何帮助都将不胜感激。谢谢!
发布于 2014-07-08 19:31:35
你有不同的名字。discountedOrderTotal对discountOrderTotal
发布于 2015-05-18 10:49:45
首先要注意的是会话的名称。它应该是相同的,当您检索会话时,您需要指定类型,因为它返回一个对象。所以,当你把这个调用到下一页时,试试这个。
e.Row.Cells[4].Text = "$" + Session["discountedOrderTotal"].ToString();发布于 2016-07-13 02:13:12
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Table ID="Table1" runat="server">
<asp:TableRow>
<asp:TableCell>Transfer Request ID</asp:TableCell>
<asp:TableCell> <asp:Label ID="Label1" runat="server" Text='<%# Eval("TransferRequestId") %>'></asp:Label></asp:TableCell>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>Employee Name</asp:TableCell>
<asp:TableCell> <asp:Label ID="Label3" runat="server" Text='<%# Eval("EmployeeName") %>'></asp:Label></asp:TableCell>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:Button ID="Button1" runat="server" Value="APPROVE" Text="Approve" OnClick="Button1_Click"></asp:Button></asp:TableCell>
<asp:TableCell><asp:Button ID="Button2" runat="server" value="REJECT" Text="Reject" Onclick="Button2_Click"></asp:Button></asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Content>https://stackoverflow.com/questions/24640188
复制相似问题