想做出纯2.0的程序,自己又懒,只好使用了这个ASP.NET 2.0 CSS Friendly Control Adapters。之前很多大侠介绍过的玩意了。
不过在用到CreateUserWizard时候,填上电子邮件正则表达式,错误提示死活出不来,关闭Adapter正常,怀疑是Adapter错误。于是开始找,终于发现,可爱的作者把空间名字写错了。
具体在CreateUserWizardAdapter.cs中
private
void
WriteFinalValidators(HtmlTextWriter writer, CreateUserWizard wizard)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
WebControlAdapterExtender.WriteBeginDiv(writer, "AspNet-CreateUserWizard-FinalValidatorsPanel", "");
WebControlAdapterExtender.WriteCompareValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("PasswordCompare") as CompareValidator, wizard.ValidatorTextStyle.CssClass, "ConfirmPassword", wizard.ConfirmPasswordCompareErrorMessage, "Password");
WebControlAdapterExtender.WriteRegularExpressionValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("PasswordRegExpValidator") as RegularExpressionValidator, wizard.ValidatorTextStyle.CssClass, "Password", wizard.PasswordRegularExpressionErrorMessage, wizard.PasswordRegularExpression);
WebControlAdapterExtender.WriteRegularExpressionValidator(writer, wizard.FindControl("CreateUserStepContainer").FindControl("EmailRegExpValidator") as RegularExpressionValidator, wizard.ValidatorTextStyle.CssClass, "Email", wizard.EmailRegularExpressionErrorMessage, wizard.EmailRegularExpression);
WebControlAdapterExtender.WriteEndDiv(writer);
}
wizard.FindControl(
"
CreateUserStepContainer
"
).FindControl(
"
EmailRegExpValidator
"
)
把这里改成
wizard.FindControl("CreateUserStepContainer").FindControl("EmailRegExp")
以后一切正常。还好这玩意是开源的,不然我怎么活啊。
控件名当然是在页面上看来的。
看来作者恨不小心,不知道还有没有类似bug。