尝试这个:
// Add the form item to the page.
var validationFailed = false;
myPanel.AddControlsReturnThis( myMod.GetEmailAddressTextFormItem( false, validationErrorNotifier: () => validationFailed = true, validationList: myPostBack ).ToControl() );
// Add the email-address-exists error placeholder to the page.
myPanel.AddControlsReturnThis(
new ModificationErrorPlaceholder(
new Validation(
( pbv, validator ) => {
if( validationFailed )
return;
if( emailAddressExists( myMod.EmailAddress ) )
validator.NoteErrorAndAddMessage( "The user will never see this." );
},
myPostBack ),
errors => {
if( !errors.Any() )
return Enumerable.Empty<Control>();
// Use any controls you want here!
var link = EwfLink.Create( MyDestinationPage.GetInfo(), new TextActionControlStyle( "has a link" ) );
return new Paragraph( new Control[] { "This sentence ".GetLiteralControl(), link, " in it.".GetLiteralControl() } ).ToSingleElementArray();
} ) );
如果您希望说明段落位于电子邮件地址表单项上方,请将其验证添加到 a BasicValidationList
,您可以在创建表单项后将其添加到回发对象中。