Hello,
I've download ckEditor and made an ASP.net control which implements the TextBox class and then replaced the textbox with the ckEditor. This all works fine.
Now I put the control on an .aspx webpage and also put a Required Field Validator on it. This validator validates if the Text property of the TextBox is not null, this is all done client side.
The only problem now rises, is that the Text property of the TextBox is not up to date. It's always one button click (when the Page_ClientValidate function is called) to late, with updating the Text property of the TextBox with the value in the ckEditor.
I googled a lot and found a few lines, see code below. When I call this JavaScript code at the OnClientClick function of the button which submits the webpage before the Page_ClientValidate() function (which triggers the Required Field Validator), it does the trick for me. Then the Text property of the TextBox is updated and the client side validation works perfect.
These lines are:
Only here rises the problem. I don't want to call this function everytime on a buttons OnClientClick event. I just want to update the Text property of the TextBox every time when the focus of the ckEditor is lost. I know ckEditor has a 'blur' method, for exampe:
But when I code this method in the ckEditor control, it is always called afther the Page_ClientValidate().
How can I call the Blur event before the Page_ClientValidate() function from within the control?
Thnx in advance. Greetings, Ferdos
I've download ckEditor and made an ASP.net control which implements the TextBox class and then replaced the textbox with the ckEditor. This all works fine.
Now I put the control on an .aspx webpage and also put a Required Field Validator on it. This validator validates if the Text property of the TextBox is not null, this is all done client side.
The only problem now rises, is that the Text property of the TextBox is not up to date. It's always one button click (when the Page_ClientValidate function is called) to late, with updating the Text property of the TextBox with the value in the ckEditor.
I googled a lot and found a few lines, see code below. When I call this JavaScript code at the OnClientClick function of the button which submits the webpage before the Page_ClientValidate() function (which triggers the Required Field Validator), it does the trick for me. Then the Text property of the TextBox is updated and the client side validation works perfect.
These lines are:
for (instance in CKEDITOR.instances) CKEDITOR.instances[instance].updateElement();
Only here rises the problem. I don't want to call this function everytime on a buttons OnClientClick event. I just want to update the Text property of the TextBox every time when the focus of the ckEditor is lost. I know ckEditor has a 'blur' method, for exampe:
CKEDITOR.instances." + ClientID.ToString() + ".on('blur', function( e ) { OnBlurCKeditor(); } );
But when I code this method in the ckEditor control, it is always called afther the Page_ClientValidate().
How can I call the Blur event before the Page_ClientValidate() function from within the control?
Thnx in advance. Greetings, Ferdos