简体   繁体   English

如何知道document.forms ['aspnetForm']。submit()在服务器端进行提交?

[英]How to know document.forms['aspnetForm'].submit() make the submit at the server side?

I use 我用

document.forms['aspnetForm'].submit() 

to submit the form. 提交表格。 There are other buttons doing some other things at the server side too. 服务器端也有其他按钮在做其他事情。

Is it possible at the server side, eg, in Page_Load(object sender, EventArgs e), use some method to check client side called this 在服务器端是否可能,例如在Page_Load(object sender,EventArgs e)中,使用某种方法来检查客户端,这称为

document.forms['aspnetForm'].submit() 

?

thanks 谢谢

================more explain=================== ================更多说明===================

for example, clicking either button below will submit the form to server side, how do I know which one is clicked in Page_Load? 例如,单击下面的任一按钮会将表单提交到服务器端,我如何知道在Page_Load中单击了哪个?

<input type="button" value="Submit" onclick="document.forms['aspnetForm'].submit()" />
<input type="submit" value="Edit" />

You can set a value in a hidden field at the same time you call the .submit() in your JavaScript. 您可以在JavaScript中调用.submit()的同时,在hidden字段中设置一个值。 Like: 喜欢:

<input type="hidden" id="client-submit" value="true" />

(Then check for that form-field value on the server-side.) (然后在服务器端检查该表单字段值。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM