Error In Control Emplemented "ICallbackEventHandler"
-
i created a validator control was inherited "BaseValidator" and implemented "ICallbackEventHandler" it's work well in normal page but generated problem when i create a MasterPage and use this control in page that use MasterPage. the error message is : "The target 'ctl00_ContentPlaceHolder1_ExistFieldValidator1' for the callback could not be found or did not implement ICallbackEventHandler" My vb code is: Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Text Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls <Assembly: WebResource("JScript.js", "application/x-javascript")> Namespace Softcam Public Class ExistFieldValidator Inherits BaseValidator Implements ICallbackEventHandler Public Event ServerValidate As ServerValidateEventHandler Dim _ControlToValidateValue As String Protected Overrides Function EvaluateIsValid() As Boolean Dim ctlToValidate As String = Me.GetControlValidationValue(Me.ControlToValidate) Return ExecuteValidationValue(ctlToValidate) End Function Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs) Dim EventRef As String = Page.ClientScript.GetCallbackEventReference(Me, "", "", "") If Me.EnableClientScript Then Page.ClientScript.RegisterClientScriptResource(Me.GetType(), "JScript.js") End If MyBase.OnPreRender(e) End Sub Protected Overrides Sub RegisterValidatorDeclaration() MyBase.RegisterValidatorDeclaration() Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "evaluationfunction", "FieldExistValidate") End Sub Protected Overrides Function DetermineRenderUplevel() As Boolean Return Context.Request.Browser.SupportsCallback End Function Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult Return ExecuteValidationValue(_ControlToValidateValue).ToString() End Function Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent _ControlToValidateValue = eventArgument End Sub Private Function ExecuteValidationValue(ByVal ctlValidation As
-
i created a validator control was inherited "BaseValidator" and implemented "ICallbackEventHandler" it's work well in normal page but generated problem when i create a MasterPage and use this control in page that use MasterPage. the error message is : "The target 'ctl00_ContentPlaceHolder1_ExistFieldValidator1' for the callback could not be found or did not implement ICallbackEventHandler" My vb code is: Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Text Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls <Assembly: WebResource("JScript.js", "application/x-javascript")> Namespace Softcam Public Class ExistFieldValidator Inherits BaseValidator Implements ICallbackEventHandler Public Event ServerValidate As ServerValidateEventHandler Dim _ControlToValidateValue As String Protected Overrides Function EvaluateIsValid() As Boolean Dim ctlToValidate As String = Me.GetControlValidationValue(Me.ControlToValidate) Return ExecuteValidationValue(ctlToValidate) End Function Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs) Dim EventRef As String = Page.ClientScript.GetCallbackEventReference(Me, "", "", "") If Me.EnableClientScript Then Page.ClientScript.RegisterClientScriptResource(Me.GetType(), "JScript.js") End If MyBase.OnPreRender(e) End Sub Protected Overrides Sub RegisterValidatorDeclaration() MyBase.RegisterValidatorDeclaration() Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "evaluationfunction", "FieldExistValidate") End Sub Protected Overrides Function DetermineRenderUplevel() As Boolean Return Context.Request.Browser.SupportsCallback End Function Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult Return ExecuteValidationValue(_ControlToValidateValue).ToString() End Function Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent _ControlToValidateValue = eventArgument End Sub Private Function ExecuteValidationValue(ByVal ctlValidation As