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

Rad spell not triggering RadTextBoxChanged on a RadTextBox

1 Answer 68 Views
Input
This is a migrated thread and some comments may be shown as answers.
p
Top achievements
Rank 1
p asked on 14 Dec 2009, 11:21 PM
Hi,

Rad spell is not triggering RadTextBoxChanged on  RadTextBox.
 I am using the updateDisplayValue on OnClientDialogClosed.
Please let me know if you need more info.

PS

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 17 Dec 2009, 12:31 PM
Hello,

Browsers do not fire the "changed" event for textboxes, when their value is updated programmatically with Javasctript by using the textbox' value property. This is the reason why you need to call updateDisplayValue() explicitly after the spell check is finished.

You can fire the event manually, but in this case you will not be able to cancel it via the event arguments. Instead, you will have the previous value at your disposal and set it back with textBoxInstance.set_value().


<%@ Page Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head runat="server">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>RadControls for ASP.NET AJAX</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
 
<telerik:RadTextBox ID="RadTextBox1" runat="server">
    <ClientEvents OnValueChanged="MyValueChanged" />
</telerik:RadTextBox>
 
<telerik:RadSpell ID="RadSpell1" runat="server" ControlToCheck="RadTextBox1" ButtonText="SpellCheck"
    OnClientDialogClosed="MyClientDialogClosed" OnClientCheckStarted="MyClientCheckStarted" />
 
<script type="text/javascript">
 
var tbOldValue;
 
function MyClientCheckStarted(sender, args)
{
    var tb = $find("RadTextBox1");
    tbOldValue = tb.get_value();
}
 
function MyClientDialogClosed(sender, args)
{
    var tb = $find("RadTextBox1");
    var tbNewValue = tb.get_value();
    tb.updateDisplayValue();
     
    if (tbNewValue != tbOldValue)
        tb.raise_valueChanged(tbNewValue, tbOldValue);
}
 
function MyValueChanged(sender, args)
{
    alert("ValueChanged");
}
 
</script>
 
</form>
</body>
</html>


Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
p
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or