views:

37

answers:

1

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(object 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.

A: 

Maybe remove "protected" from the Accountname_CheckUnique method definition?

Damien
No (and I did try anyway), you'd get a "foo does not contain a definition for 'Accountname_CheckUnique'" error if it was a scoping issue.
annakata
I'm a noob here, it would have been better if I entered this as a comment. Also should have checked your reputation before posting the obvious suggestion <grin>. Should I delete the answer so this goes back under "unanswered"?
Damien
No, it's helpful to have wrong answers because it's educational for future readers and it prevents other people posting the same. Any well intentioned answer is valuable, regardless of whether it also happens to be correct. (and rep is just a number, you'll get there)
annakata