Click here to Skip to main content
15,884,388 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Changing LabelText via Java Script Pin
N a v a n e e t h28-Sep-09 4:15
N a v a n e e t h28-Sep-09 4:15 
AnswerRe: Changing LabelText via Java Script Pin
Abhishek Sur28-Sep-09 7:08
professionalAbhishek Sur28-Sep-09 7:08 
GeneralRe: Changing LabelText via Java Script Pin
vivekphlp28-Sep-09 20:27
vivekphlp28-Sep-09 20:27 
GeneralRe: Changing LabelText via Java Script Pin
Abhishek Sur28-Sep-09 21:11
professionalAbhishek Sur28-Sep-09 21:11 
QuestionLooking for a web survey tool... Pin
Andres Coder27-Sep-09 21:05
Andres Coder27-Sep-09 21:05 
AnswerRe: Looking for a web survey tool... Pin
majee28-Sep-09 3:48
majee28-Sep-09 3:48 
AnswerRe: Looking for a web survey tool... Pin
fwsmaster30-Apr-11 3:05
fwsmaster30-Apr-11 3:05 
QuestionError In Control Emplemented "ICallbackEventHandler" Pin
alireza_s_8427-Sep-09 20:29
alireza_s_8427-Sep-09 20:29 
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 String) As Boolean

Dim args As New ServerValidateEventArgs(ctlValidation, Me.IsValid)

RaiseEvent ServerValidate(Me, args)

Return args.IsValid

End Function



End Class

End Namespace

And Javascript Code:

function
FieldExistValidate(val)

{

var
value = ValidatorGetValue(val.controltovalidate);

if
(ValidatorTrim(value).length == 0)

return
true
;

WebForm_DoCallback(val.id, value, AjaxValidatorResult, val, AjaxValidatorError, true
);

return
true
;

}



function
AjaxValidatorResult(returnValue,context)

{

if
(returnValue.toLowerCase() == 'true'
)

context.isvalid = true
;

else


context.isvalid = false
;

ValidatorUpdateDisplay(context);

}



function
AjaxValidatorError(message)

{

alert(message);

}
AnswerRe: Error In Control Emplemented "ICallbackEventHandler" Pin
majee28-Sep-09 4:00
majee28-Sep-09 4:00 
QuestionInVoke a function automatically Pin
Ha_8027-Sep-09 19:27
Ha_8027-Sep-09 19:27 
AnswerRe: InVoke a function automatically Pin
Christian Graus27-Sep-09 19:41
protectorChristian Graus27-Sep-09 19:41 
GeneralRe: InVoke a function automatically Pin
Abhishek Sur28-Sep-09 6:35
professionalAbhishek Sur28-Sep-09 6:35 
AnswerRe: InVoke a function automatically Pin
Abhishek Sur28-Sep-09 6:40
professionalAbhishek Sur28-Sep-09 6:40 
QuestionN-Tier ASP.NET Pin
Illegal Operation27-Sep-09 15:36
Illegal Operation27-Sep-09 15:36 
AnswerRe: N-Tier ASP.NET Pin
Not Active27-Sep-09 15:52
mentorNot Active27-Sep-09 15:52 
GeneralRe: N-Tier ASP.NET Pin
Illegal Operation27-Sep-09 16:06
Illegal Operation27-Sep-09 16:06 
GeneralRe: N-Tier ASP.NET Pin
Christian Graus27-Sep-09 16:31
protectorChristian Graus27-Sep-09 16:31 
AnswerRe: N-Tier ASP.NET Pin
Vimalsoft(Pty) Ltd28-Sep-09 2:15
professionalVimalsoft(Pty) Ltd28-Sep-09 2:15 
QuestionGridview Merge Rows? Pin
Lash2027-Sep-09 14:44
Lash2027-Sep-09 14:44 
AnswerRe: Gridview Merge Rows? Pin
Christian Graus27-Sep-09 14:53
protectorChristian Graus27-Sep-09 14:53 
GeneralRe: Gridview Merge Rows? Pin
Lash2027-Sep-09 15:19
Lash2027-Sep-09 15:19 
GeneralRe: Gridview Merge Rows? Pin
Christian Graus27-Sep-09 16:00
protectorChristian Graus27-Sep-09 16:00 
GeneralRe: Gridview Merge Rows? Pin
Lash2027-Sep-09 16:56
Lash2027-Sep-09 16:56 
QuestionCannot run a website hosted outside. Locally works. Pin
Takhir27-Sep-09 12:11
Takhir27-Sep-09 12:11 
AnswerRe: Cannot run a website hosted outside. Locally works. Pin
Christian Graus27-Sep-09 13:23
protectorChristian Graus27-Sep-09 13:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.