views:

630

answers:

4

Hi. I wonder why I can't get value from FCKEditor with this javascript? I work with asp.net so I know the controls get different names, mine is in a placeholder and in a usercontrol. How should I approach it to find the FCKEditor?

thx

function test()
{
    var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
    var pageValue = oEditor.GetHTML();

    alert(pageValue);
}
A: 
FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID%>')
Jan Jongboom
A: 

This should work, but the problem is that using this approach you can not have this function in external JavaScript file. It has to be inline in your asp.net page.

function test()
{
    var oEditor = FCKeditorAPI.GetInstance(<%= FCKeditor1.ClientID%>);
    var pageValue = oEditor.GetHTML();

    alert(pageValue);
}
Mahin
i tried that but my fckeditor is located in a usercontrol so the fckeditor is not on intellicense if you know what i mean? it just wont work writing like that..
Dejan.S
put this function in your user control. You can still access the java script function.
Mahin
to get around the 'inline' in the asp.net page problem, you can do a server side include on the external javascript file
AdamRalph
A: 

ASP.NET generates different IDs to the ones you use based on their position within the DOM. You should use the ClientID from within the client code to get at the actual ID, but without seeing the mark-up I can't tell for sure.

Kieron
A: 

i tried this code an it work

FCKeditorAPI.GetInstance('ctl00_ContentPlaceHolder1_ctl00_FCKeditor1');

i tried

FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID%>')

thing that last wont work cause i got page - usercontrol - fckeditor so the intellesence wont show the fckeditor. i would like to make it work with the last one so i dont have to put the "ctl00_ContentPlaceHolder1_ctl00_FCKeditor1"

Dejan.S
Please use comments or Edit your answer to further discuss the problem.
Mahin
i will do that.
Dejan.S