public ActionResult CustomValidatorPost(FormD form) { string ex = ""; if (form.drpState == null && form.txtRegion == null) { ex = "Error. All fields should be filled out."; return(RedirectToAction("CustomValidator", "Home", new { ex })); } ex = "Validated!"; Console.WriteLine(form); return(RedirectToAction("CustomValidator", "Home", new { ex })); }
void Foo() { SetNativeEnabled(false); // defined above FormD f = new FormD(); f.Closed += (s, e) => { switch (f.DialogResult) { case DialogResult.OK: // Do OK logic break; case DialogResult.Cancel: // Do Cancel logic break; } SetNativeEnabled(true); }; f.Show(this); // function Foo returns now, as soon as FormD is shown }