我有一个TextBox
namedTextBoxValue
和一个Button
namedButtonGetValue
位于ASP WebForm
named上DestinationPage.aspx
。我正在做的是TextBox
用我从上一页使用传递到此页面的值填充QueryString
. 我正在通过以下方式实现它:
<asp:Button ID="ButtonCompute" runat="server" Text="Compute" OnClick="ButtonCompute_Click" ValidationGroup="ComputeGroup"/
ButtonCompute
位于Button
上SourcePage.aspx
,单击它只需将数据传递给DestinationPage.aspx
fromSourcePage.aspx
。这不是Button
我之前所说的。
中的代码SoucePage.aspx.cs
:
int valueForDestination = 10;
Response.Redirect("~/DestinationPage.aspx?Value = + valueForDestination);
中的代码DestinationPage.aspx.cs
:
int valueFromQS = Request.QueryString["Value"];
TextBoxValue.Text = valueFromQS;
<asp:Button ID="ButtonGetValueValue" runat="server" Text="Get Value" onclick="ButtonGetValue_Click" />
现在,我在这里所做的是,一旦值显示在 中TextBoxValue
,将其更改为100
from 10
。然后我点击ButtonGetValue
。但不是得到100
; 这是我得到的更新值10
;这是初始值。如何获得更新的值?
编辑 1.0
我很抱歉没有明确提及我想要做什么ButtonGetValue
。这Button
只是从 中读取值TextBox
并在屏幕上打印该值。
我正在努力ASP.NET WebForms
。