This is a migrated thread and some comments may be shown as answers.

Event while adding text to dictionary

7 Answers 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Venki
Top achievements
Rank 1
Venki asked on 13 May 2010, 11:33 AM
Hello,
I am using radeditor and just enabled spell check. I have a requirement to log some data in databse when ever user adds word to dictionary. Is there any event which fires so that I can do logging inside that? If you could send me some sample code, that would help.

Venki

7 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 May 2010, 02:03 PM
Hi Venki,

RadEditor does not offer out-of-the box an event that is fired when the a custom word is added. What you can do is to implement your own custom dictionary source. You can see an example of a custom dictionary source in this KB article: Changing the custom dictionary files location.

Regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Venki
Top achievements
Rank 1
answered on 14 May 2010, 12:37 PM
Thanks Telerik Team. I am able to implement this and getting it working. I have changed it to add the custom word to database instead of flat file as we have 2 web servers in production, flat file will be problematic.

I have implemented it and its getting added to database and retrieves it. No issues in my sample application as I know the connection string. 

The challenge I am facing is, In my application, the connection string is getting created dynamically and I need to pass a connection string object to the "ICustomDictionarySource" implementer.

Look at the below code
<rad:radspell id="variableValueRadSpell" runat="server" buttontype="none"  CustomDictionarySourceTypeName="RRD.DSA.SCP.ObjectModel.Factories.SpellCheckFactory, RRD.DSA.SCP.ObjectModel.Factories" />   
    <table style="margin-left: 10px; margin-top: 8px;" border="0" 
        cellpadding="0" cellspacing="0" width="590px"
        <tr> 
            <td colspan="2"
            <rad:RadEditor runat="server" Width="590px" Height="375px" ID="VariableValueEditor"
                <Tools> 
                    <rad:EditorToolGroup> 
                         
                    </rad:EditorToolGroup> 
                </Tools> 
            </rad:RadEditor> 
                 
             
            </td> 
        </tr> 
        <tr><td colspan="2" class="ms-formlabel"
        <asp:CheckBox ID="chkBlank" runat="server" Text="Intentionally Blank" /></td></tr> 
    </table> 



 <script type="text/javascript"
        Telerik.Web.UI.Editor.CommandList.SpellCheck = function (commandName, editor) { 
            var spell = GetRadSpell('<%= variableValueRadSpell.ClientID %>'); 
            spell.spellCheck(new PrometheusTextSource(editor)); 
            return false
        } 
        var PrometheusTextSource = function (editor) { 
            this._editor = editor; 
            this.get_text = function () { return this._editor.get_html(); }; 
            this.set_text = function (value) { this._editor.set_html(value); }; 
        }    
</script>   

Issue is, my spell check factory is not getting initialized explicitly. How can I pass connection string object to my spellcheckfactory?

Venki
0
Venki
Top achievements
Rank 1
answered on 17 May 2010, 04:50 AM
Telerik Team, Any update on this?
0
Rumen
Telerik team
answered on 17 May 2010, 10:00 AM
Hi Venki,

You can pass the connection string object through the session state.
The ICustomDictionarySource is a separate object and it is not related to the rest of the application.

Kind regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Venki
Top achievements
Rank 1
answered on 17 May 2010, 11:57 AM
Rumen, thanks for your reply. Even I was thinking I can use session and used it. Looks like session objects are not enabled in telerik controls. Through out my application, I can access sessions. But only when I call IcustomDatasource implemented methods, I get below error.

Is there some place I need to change in Telerik?

"
I get this error "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"
"

Please let me know...

Venki
0
Lini
Telerik team
answered on 17 May 2010, 04:56 PM
Hello Venki,

I checked this scenario and can confirm that it is not possible to access the session object in a custom dictionary source for RadSpell. This happens because the RadSpell handler (Telerik.Web.UI.SpellCheckHandler.axd) does not implement the IRequiresSessionState interface. I have logged this issue and it will be fixed in the next RadControls release. For now, if you want to access the session during a spellchecking request, you need to define a custom handler, inheriting from the default SpellCheckHandler class, and mark it with the above interface. See the last reply in this forum thread for a sample implementation - http://www.telerik.com/community/forums/aspnet-ajax/spell/different-custom-dictionary-path.aspx#1100817

Best wishes,
Lini
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Venki
Top achievements
Rank 1
answered on 18 May 2010, 05:29 AM
Thanks Telerik Team. I have followed a different approach and achieved it. Will make use of this in case I need it in future.
Tags
Editor
Asked by
Venki
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Venki
Top achievements
Rank 1
Lini
Telerik team
Share this question
or