6
Vote

ValidatorCalloutExtender does not work when validating UserControl

description

Following the instructions on how to validate user control: http://support.microsoft.com/kb/310082, I have seet up this simple example.

Test.aspx

<%@ Register src="ucTest.ascx" tagname="ucTest" tagprefix="ucApp" %>
<asp:UpdatePanel ID="uppValidate" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnValidate" EventName="Click" />
    </Triggers>
    <ContentTemplate>
        <ucApp:ucTest ID="ucValidate" runat="server" />
        <asp:RequiredFieldValidator ID="rfvValidate" runat="server" 
            ControlToValidate="ucValidate"
            SetFocusOnError="true" 
            EnableClientScript="false"
            ErrorMessage="This field is required"
            Display="None" 
        />
        <ajaxToolkit:ValidatorCalloutExtender ID="vceValidate" runat="server" 
            TargetControlID="rfvValidate" 
        />
    </ContentTemplate>
</asp:UpdatePanel>

<br /><br />
<asp:Button ID="btnValidate" runat="server" Text="Submit" />
ucTest.Aaspx========
Text: <asp:TextBox ID="tbxTitle" runat="server" />

ucTest.Aspx.vb

<ValidationProperty("Text")> _
Partial Class Other_ucTest
Inherits System.Web.UI.UserControl

Public Overrides Sub Focus()
    Me.tbxTitle.Focus()
End Sub

Public ReadOnly Property Text() As String
    Get
        Return Me.tbxTitle.Text
    End Get
End Property

End Class

When running the page I get this error:

Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors.
Parameter name: element

I have tried all kinds of changes to this code, but could not make it work.

robche

comments

colem wrote Mar 11, 2009 at 10:13 PM

Is there an expected date for a fix? Is there a workaround I can use?

It seems the issue is being caused by the ValidatorCalloutExtender extending a validator that has EnableClientScript="false". That is the common item between this posted issue and the one I am facing.

psandrini wrote Oct 19, 2009 at 6:27 PM

Same Problem! Workarounds??

ngrennan wrote Nov 9, 2009 at 10:36 AM

Same Issue