检查表单是否已在aspx中提交

Boa*_*rdy 2 c# asp.net

我只有ASP表格.页面加载时,它使用Page_Load事件处理程序运行一个方法.当用户提交表单时如果没有正确地重新验证它返回到页面但我不希望Page_Load的方法运行.

有没有办法可以检查表单是否已经提交过,而无需检查表单中的特定字段.

感谢您的任何帮助,您可以提供.

Jer*_*emy 6

在您的Page_Load方法中,只有在IsPostBack为false时才进行处理)

//Page_Load method
If (!IsPostBack)
{
  // Code in here should only run when the page first loads.  
  // It will not run if a user clicks a button on the page.
}
Run Code Online (Sandbox Code Playgroud)