hgs yükleme
My Cart (0)  |  My Orders  |  My Downloads  |  My Auction  |  My Account  |  Help


Login |Register        Search

Get Instance Of FCKEditor/DNN:TextEditor Controls In js

                Print      Add To Favorite     Add To Watch List     Contact Author

Creator: host   8/27/2012 4:25:41 AM    Author: Sunil Behera   Source: http://www.mindfiresolutions.com/Get-Instance-Of-FCKEditorDNNTextEditor-Controls-In-DNN-On-ClientSide-1842.php   Views: 3020    0    0  
Tags:
FCKEditor Module develop Java script

Here I have used dnn:texteditor in my ascx page. I need to set some value to it on client side. Main issue here is that getting the instance of the dnn:TextEditor instance on client side. For server side value setting we can easily do it using the 'text' property but for Client side some tricks to be required.

 

//NewNotifications.ascx
 
    //DNN Editor used in .ascx page
    <dnn:TextEditor ID="txtContent" runat="server" height="350" width="700" >
    </dnn:TextEditor>
   
    //Button
    <input type="button" id="btnGetInstance" value="Get Value from Editor"/>
   
    Now for accessing the editor, this control is actually rendered into HTML which used the parents control name twice.
    For example, if you named your editor “txtContent”, then after rendering it would be "dnn_ctr###_PageName_txtContent_txtContent"
    (replace ### with your Module control’s number).
   
    <script type="text/javascript">
   
    $(document).ready(function () {
        $('#btnGetInstance').bind('click', function () {
            //get instance of editor
            var editor = FCKeditorAPI.GetInstance('dnn_ctr958_NewNotification_txtContent_txtContent');
           
            //Paste the text at current cursor position
            ControlOnWhichToBePasted.InsertHtml('mindfire solutions');
            });
        });

    </script>

    For "dnn_ctr958_NewNotification_txtContent_txtContent " my
   
    ascx page is : NewNotification.ascx
    module number: 958
    dnn editor id: txtContent

Rating People: 8   Average Rating:     

     DnnModule.com is built to provide DNN quality modules and DNN skins, some of them are free, some not. We wish these stuffs (free or not ) can be useful to you.

     Besides that, we also provide a full range of professional services, ranging from web site build, seo, system management, administration, support, senior consultancy and security services. We act as if your development project or network was ours, with care and respect. We are not satisfied until it works the way you want it to, and we don't silently ignore found issues as somebody else's problem.