I need to reach my codebehind click event from ckeditor button.
i am trying with this code for my custom ckeditor button(function () {
//Section 1 : Code to execute when the toolbar button is pressed
var a = {
exec: function (editor) {
var testObj = editor.parentNode;
var count = 1;
while (testObj.getAttribute('id') != "form1") {
testObj = testObj.parentNode;
}
testObj.getElementById('<%= btnUserControls.ClientID %>').click();
}
},
//Section 2 : Create the button and add the functionality to it
b='usercontrols';
CKEDITOR.plugins.add(b,{
init:function(editor){
editor.addCommand(b,a);
editor.ui.addButton('usercontrols', {
label:'User Controls',
icon: this.path + 'ascx.png',
command:b
});
}
});
})();
But i think this code cannot reach my Asp.Net button.Where am i wrong ? Thanks.
It is hard to say exactly without knowing your .aspx code, but most probably the id of your form is not “form1” on client side. You can try modyfing your code like this:
or even like this: