RadMarkupDialog and SpellCheck

2 posts, 0 answers
  1. Mike Maynard
    Mike Maynard avatar
    3 posts
    Member since:
    May 2003

    Posted 04 Jun 2014 Link to this post

    Hi all,
    I am currently using the RadMarkupDialog to enable HTML markup on a column in a RadGridView.
    I would like to enable spell check on the entered text somehow but cannot seem to see how to do this.

    The code I am using to display the dialog and set the text is

    Dim dialog As New RadMarkupDialog()
                                dialog.DefaultFont = RadGridView1.Font
                                dialog.Editor.RibbonBar.CommandTabs(1).Enabled = False
                                dialog.Editor.HyperlinkButton.Enabled = False
                                dialog.Value = RadGridView1.CurrentCell.Text
                                Dim result As DialogResult = dialog.ShowDialog()
                                If result = DialogResult.OK Then
                                    Me.RadGridView1.CurrentCell.Value = dialog.Value
                                Else
                                End If

    Any ideas on how to do this?
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 09 Jun 2014 Link to this post

    Hello Mike,

    Thank you for writing.

    RadMarkupDialog uses WebBrowser to display the HTML-like text. It is not possible to spell check it using the RadSpellChecker for example, as it supports only RadTextBox, RadTextBoxControl and TextBox controls. The possible solution that I can suggest is to use the RadGridView.CellValidating event in order to validate the active editor's content, when the current cell exits edit mode. Thus, if the html content is incorrect, canceling the CellValidating event, will keep the editor active until a valid text is entered. 
    Private Sub RadGridView1_CellEditorInitialized(sender As Object, e As GridViewCellEventArgs) _
    Handles RadGridView1.CellEditorInitialized
     
        If e.Column.HeaderText = "HTMLcolumn" Then
            Dim dialog As New RadMarkupDialog()
            dialog.DefaultFont = RadGridView1.Font
            dialog.Editor.RibbonBar.CommandTabs(1).Enabled = False
            dialog.Editor.HyperlinkButton.Enabled = False
            dialog.Value = RadGridView1.CurrentCell.Value
           
            Dim result As DialogResult = dialog.ShowDialog()
            If result = DialogResult.OK Then
                e.ActiveEditor.Value = dialog.Value
            End If
        End If
    End Sub
     
    Private Sub RadGridView1_CellValidating(sender As Object, e As CellValidatingEventArgs) _
    Handles RadGridView1.CellValidating
        If Me.RadGridView1.CurrentColumn.HeaderText = "HTMLcolumn" Then
            Dim htmlText = Me.RadGridView1.ActiveEditor.Value
            'perform validation of the text and if it is incorrect, cancel the event
        End If
    End Sub

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top