Thursday, January 24, 2008

Creating Your Own Ajax ControlToolkit Extender Control

Great resources here:
I can across an interesting gotcha when creating my first ajax control extender (created a validator extender control, which "highlight" a target control if validation fails)


The javascript error only happens in IE. FF is quite forgiving.

Expected Identifier, string or number

When I clicked Yes to debug, it takes me to the below line of code in Visual Studio...

$create(KbWebToolkit.ValidatorHighlightBehavior, {"HighlightControlID":"",
"HighlightCssClass":"error_highlight","id":"NReq_HL"}

Debugging it further would return the javascript below:

Microsoft JScript runtime error: 'KbToolkit' is undefined

Fix:
Remove the last comma in the prototype definition.

2 comments:

Anonymous said...

which comma shld be removed ?

Noel H said...

Look for the closing curly bracket for the last prototype js function.

Removed the comma that follows.