我用
document.forms['aspnetForm'].submit()
提交表单。还有其他按钮也在服务器端执行其他一些操作。
是否可以在服务器端,例如,在 Page_Load(object sender, EventArgs e) 中,使用某种方法来检查称为此的客户端
document.forms['aspnetForm'].submit()
?
谢谢
===============更多说明===================
例如,单击下面的任一按钮都会将表单提交到服务器端,我如何知道在Page_Load中单击了哪一个?
<input type="button" value="Submit" onclick="document.forms['aspnetForm'].submit()" />
<input type="submit" value="Edit" />
最佳答案
您可以在 JavaScript 中调用 .submit()
的同时在隐藏
字段中设置值。喜欢:
<input type="hidden" id="client-submit" value="true" />
(然后在服务器端检查该表单字段值。)
关于javascript - 如何知道 document.forms ['aspnetForm' ].submit() 在服务器端进行提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12735994/