我有一个TextBoxnamedTextBoxValue和一个ButtonnamedButtonGetValue位于ASP WebFormnamed上DestinationPage.aspx。我正在做的是TextBox用我从上一页使用传递到此页面的值填充QueryString. 我正在通过以下方式实现它:
<asp:Button ID="ButtonCompute" runat="server" Text="Compute" OnClick="ButtonCompute_Click" ValidationGroup="ComputeGroup"/
ButtonCompute位于Button上SourcePage.aspx,单击它只需将数据传递给DestinationPage.aspxfromSourcePage.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,将其更改为100from 10。然后我点击ButtonGetValue。但不是得到100; 这是我得到的更新值10;这是初始值。如何获得更新的值?
编辑 1.0
我很抱歉没有明确提及我想要做什么ButtonGetValue。这Button只是从 中读取值TextBox并在屏幕上打印该值。
我正在努力ASP.NET WebForms。