ソースエラー:
Line 62: <asp:CreateUserWizard ID="CreateUserWizard1" // error appeared here
Line 63: runat="server"
Line 64: OnCreatedUser="CreateUserWizard1_CreatedUser"
createuserwizardがありました。また、ステップ2でユーザーが間違った入力をした場合、イベントはキャンセルされます。これを行うためにe.cancel=trueを使用しました。しかし、それはこのエラーにつながりました。
'CreateUserWizard1_CreatedUser'のオーバーロードはデリゲート'System.EventHandler'と一致しません
背後にあるコード:
protected void CreateUserWizard1_CreatedUser(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
{
MSCaptcha.CaptchaControl Captcha1 = (CreateUserWizardStep1.ContentTemplateContainer.FindControl("Captcha1") as MSCaptcha.CaptchaControl);
TextBox txtCaptcha = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("txtCaptcha");
Label Captchalbl = (Label)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Captchalbl");
Response.Write(txtCaptcha.Text);
Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
if (!Captcha1.UserValidated)
{
Captchalbl.Text = "InValid";
Response.Write(Captchalbl.Text);
// Captchalbl.ForeColor = System.Drawing.Color.Red;
e.Cancel = true;
}
else
{
Captchalbl.Text = "Valid";
Response.Write(Captchalbl.Text);
TextBox UserNameTextBox = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
SqlDataSource dataSource = (SqlDataSource)CreateUserWizardStep1.ContentTemplateContainer.FindControl("InsertExtraInfo");
MembershipUser user = Membership.GetUser(UserNameTextBox.Text);
dataSource.InsertParameters.Add("UserId", user.ProviderUserKey.ToString());
dataSource.Insert();
}
}
コードは次のとおりです。
<asp:CreateUserWizard ID="CreateUserWizard1" //here is line 62
runat="server"
OnCreatedUser="CreateUserWizard1_CreatedUser"
InvalidPasswordErrorMessage="Password length must be more than 8 characters."
ContinueDestinationPageUrl="~/Home.aspx"
DisplayCancelButton = "True"
CancelDestinationPageUrl="~/Home.aspx"
DisableCreatedUser="True"
OnSendingMail="CreateUserWizard1_SendingMail"
>