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

Check spelling without click spell button.

4 Answers 99 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Zash
Top achievements
Rank 1
Zash asked on 01 Mar 2011, 12:24 AM

I try to check spelling text at several radtexteditors before data is saved, and I don't want to user to click "spell" button.  Instead, I put it at link button

 

 

OnClientClick

 

="StartCheck()"

and a javescript:

 

 

 

function StartCheck() {

 

 

 

 

var spell = $find('<%=FormViewComment.FindControl("RadSpell10").ClientID %>');

 

 

spell.startSpellCheck();

 

 

 

return false

 

 

 

 

 

 

 

}

which is inside a RadCodeBlock.

Spelling control is like this:

 

 

 

 

<telerik:RadSpell ID="RadSpell10" Runat="server" Skin="Vista" ControlsToCheck='<%# new string[3] {FormViewComment.FindControl("RadTextBoxOpportunities").ClientID, FormViewComment.FindControl("RadTextBoxSummary").ClientID, FormViewComment.FindControl("RadTextBoxSummary").ClientID}%>'

 

 

 

 

IsClientID="true" SupportedLanguages="en-US,English" ButtonType="none" />

All three textbox are inside a FormView Control, and it is inside an asp customer control.

When I click the link button to fire spell check, spell check dialog box does show up, but it pompup a "complete spelling check" message although some text is not spelled correctly, and give me some wired client script error which I don't understand.  Please let me know what mistake I made.

Thanks

 

4 Answers, 1 is accepted

Sort by
0
Zash
Top achievements
Rank 1
answered on 01 Mar 2011, 11:44 PM
It is an ergent problem.  My project done without spelling check now, and we want to release our project with spelling check.  Due date is now.  Please give us a help ASAP.

Thanks
0
Rumen
Telerik team
answered on 02 Mar 2011, 04:38 PM
Hello Zash,

You should set return false; after the StartCheck(); function in the OnClientClick event of the LinkButton, e.g.

<asp:LinkButton ID="Label1" OnClientClick="StartCheck();return false;" runat="server">Spellcheck</asp:LinkButton>

This will prevent the postback which occurs after clicking the LinkButton and the spellchecker will successfully update the textboxes.

If this does not solve the problem, please open a support ticket and send a simple working project which demonstrates the issue. I will debug it and provide a solution.

All the best,
Rumen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Zash
Top achievements
Rank 1
answered on 02 Mar 2011, 07:12 PM
"return false" is in my javascript. 

I simplify my code to 3 controls in a page: a textbox, a linkbutton, and a spelling check.  I hope when user click linkbutton, spelling check will be fired before goes to server click event.  I could not make it work.  Here is the code:

 

 

 

<%

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

 

<%

@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>

 

 

 

 

 

 

<!

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

 

<

 

html xmlns="http://www.w3.org/1999/xhtml">

 

 

<

 

head runat="server">

 

 

 

 

 

 

 

 

<title></title>

 

 

</

 

head>

 

 

<

 

body>

 

 

 

 

 

 

 

 

<form id="form1" runat="server">

 

 

 

 

 

 

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnableTheming="True">

 

 

 

 

 

 

 

 

</telerik:RadScriptManager>

 

 

 

 

 

 

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

 

 

 

 

 

 

<script type="text/javascript">

 

 

 

 

 

 

 

 

function StartTextBoxCheck() {

 

 

 

var spell = $find('<%= RadSpell2.ClientID %>');

 

 

spell.startSpellCheck();

 

 

return false;

 

 

}

 

 

</script>

 

 

 

 

 

 

 

 

</telerik:RadCodeBlock>

 

 

 

 

 

 

 

 

<div>

 

 

 

 

 

 

 

 

<telerik:RadSpell ID="RadSpell2" runat="server" ButtonType="None" IsClientID="true" />

 

 

 

 

 

 

 

 

<telerik:RadTextBox ID="RadTextBox1" runat="server">

 

 

 

 

 

 

 

 

</telerik:RadTextBox>

 

 

 

 

 

 

 

 

<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="StartTextBoxCheck()">LinkButton</asp:LinkButton>

 

 

 

 

 

 

 

 

</div>

 

 

 

 

 

 

 

 

</form>

 

 

</

 

body>

 

 

</

 

html>

 


using

 

System;

 

using

 

System.Collections.Generic;

 

using

 

System.Linq;

 

using

 

System.Web;

 

using

 

System.Web.UI;

 

using

 

System.Web.UI.WebControls;

 

public

 

partial class _Default : System.Web.UI.Page

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

 

{

 

 

string[] controls = new string[1];

 

 

controls[0] = RadTextBox1.ClientID ;

 

RadSpell2.ControlsToCheck = controls;

 

}

 

}


Please help me to make this code work.  Our project is in production now, we hope to solve this problem now.

Thanks
0
Rumen
Telerik team
answered on 07 Mar 2011, 05:10 PM
Hi Zash,

As I already noted in my previous post you should set return false after the StartTextBoxCheck execution in the onclientclick event property of the LinkButton, e.g.
Copy Code
<script type="text/javascript">
    function StartTextBoxCheck() {
            var spell = $find('<%= RadSpell2.ClientID %>');
            spell.startSpellCheck();
            return false;
        }
    </script>
</telerik:RadCodeBlock>
<div>
    <telerik:RadSpell ID="RadSpell2" runat="server" ButtonType="None" IsClientID="true" />
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
    </telerik:RadTextBox>
    <asp:linkbutton id="LinkButton1" runat="server" onclientclick="StartTextBoxCheck();return false;">LinkButton</asp:linkbutton>

For your convenience I have attached my test project.

Greetings,
Rumen
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Spell
Asked by
Zash
Top achievements
Rank 1
Answers by
Zash
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or