【发布时间】:2018-08-22 14:53:13
【问题描述】:
我有以下网络表单:
工作表:
<form id="transactionParameters" method="post" runat="server" action="remote_url.aspx">
<fieldset>
<p>
<label for="Username">Username:</label>
<asp:TextBox id="Username" Text="TomSelleck" runat="server" />
</p>
<asp:Button ID="SubmitForm" runat="server" onclick="SubmitForm_Click" Text="Button" />
</fieldset>
</form>
这成功地将表单值Username提交给remote_url.aspx并将用户带到远程页面。
我面临的问题是我需要在提交表单并重定向用户之前向表单添加一个值,例如:
所需功能:
<form id="transactionParameters" method="post" runat="server">
<fieldset>
<p>
<label for="Username">Username:</label>
<asp:TextBox id="Username" Text="TomSelleck" runat="server" />
</p>
<asp:Button ID="SubmitForm" runat="server" onclick="SubmitForm_Click" Text="Button" />
</fieldset>
</form>
// This method is fired but I don't know how to execute the commented out code
protected void SubmitForm_Click(object sender, EventArgs e)
{
// Form["Username"] = Username.Text.Uppercase();
// Form["NewValue"] = DateTime.Now.ToString();
// ExecuteAction(Form, "remote_url.aspx");
}
【问题讨论】:
-
OnClientClick不起作用或具有类样式并且按钮上的 jQuery 侦听器不起作用? -
SubitForm_Click被解雇 - 但我不知道如何执行我已注释掉的伪代码 -
您是否尝试将值从一页传递到另一页?
-
没错——所以当我在我的第一个示例中提交表单时——表单元素被传递到
action="remote_url.aspx"并且用户被定向到该页面。我想在我的SubmitForm_Click方法中做同样的事情