开发者

ASP.NET CustomValidator trying to match to System.EventHandler?

开发者 https://www.devze.com 2022-12-27 05:03 出处:网络
I have markup so: <asp:TextBox runat=\"server\" ID=\"Accountname\" /> <asp:CustomValidator runat=\"server\" ControlToValidate=\"Accountname\" OnServerValidate=\"Accountname_CheckUnique\" met

I have markup so:

<asp:TextBox runat="server" ID="Accountname" />
<asp:CustomValidator runat="server" ControlToValidate="Accountname" OnServerValidate="Accountname_CheckUnique" meta:resourcekey="ACCOUNTNAME_UNAVAILABLE" />

Codebehind so:

protected void Accountname_CheckUnique(ob开发者_如何转开发ject source, ServerValidateEventArgs arguments)
{
    arguments.IsValid = Foo();     
}

Which was working just fine, and then without changing anything on the page ASP now insists:

No overload for 'Accountname_CheckUnique' matches delegate 'System.EventHandler'

Well no, and nor should it according to MSDN. It's late and I'm tired, anybody know how to fix this or point out the glaring flaw in my comprehension?

Edit:

I've also tried += binding as an eventhandler in the codebehind and it still requires the EventArgs signature. Makes. No. Sense.

Edit 2:

Deleted and recreated the page entirely (copy paste) and problem went away. Assume some niche thing created a very localised problem.

@MODS: Please close.


Maybe remove "protected" from the Accountname_CheckUnique method definition?

0

精彩评论

暂无评论...
验证码 换一张
取 消