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

Doesn't update text until box is given focus

22 Answers 375 Views
Spell
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 15 Jul 2008, 06:08 PM
I have a RadGrid with a RadTextBox that gets spell-checked by RadSpell (read that 3 times fast)

i get the box to come up, and can change the misspelled word, but it doesn't update in the text box until i click on the box, or give it focus.  if i never give the changed box focus, the field doesn't update

this happens in IE and firefox
here is part of my code
<EditItemTemplate> 
  <telerik:RadTextBox Label="Note*" Rows="2" Width="400px" TextMode="MultiLine" runat="server" ID="Note" Text='<%# Bind("Note") %>' /> 
  <asp:RequiredFieldValidator ControlToValidate="Note" ErrorMessage="This field is required" runat="server" />               
  <telerik:RadSpell ControlToCheck="Note" ID="SpellNote" runat="server" ButtonType="LinkButton" /> 
</EditItemTemplate> 

22 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 17 Jul 2008, 07:11 AM
Hi Tom,

Please review the following help article that describes how to resolve this problem:
http://www.telerik.com/help/aspnet-ajax/input_radtextboxspellcheck.html


I hope this helps.

Sincerely,
George
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael
Top achievements
Rank 1
answered on 17 Dec 2008, 10:05 PM
If put this code in my program practically verbatim, however updateDisplayValue does not show in my intellisense.  i am assuming it is not a valid method.   EVerything works fine, until it gets to radTextBox1.updateDisplayValue(); and then I get a benine javascript error.  

Thanks
Mike
0
Rumen
Telerik team
answered on 20 Dec 2008, 12:35 PM
Hello Michael,

Please, make sure that you are using the latest Q3 SP1 version of RadControls for ASP.NET AJAX as well as see my answer in your support ticket on the subject.


Best wishes,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 04 Jan 2009, 07:57 PM
So, I have the same problem.  What was the solution?   I am using Q1 2008.
0
Dimo
Telerik team
answered on 06 Jan 2009, 04:28 PM
Hello Karl,

An alternative solution to the one provided before is to associate a client id to the RadSpell control. Note that in this case the RadSpell IsClientID property is set to "True"


ASPX

<telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
 
<telerik:RadSpell 
    ID="RadSpell1" 
    runat="server" 
    OnLoad="RadSpell1_Load" 
    IsClientID="true" /> 



C#

protected void RadSpell1_Load(object sender, EventArgs e) 
    RadSpell spell = sender as RadSpell; 
    string[] NewControlsToCheck = new string[spell.ControlsToCheck.Length + 1]; 
    spell.ControlsToCheck.CopyTo(NewControlsToCheck, 0); 
    NewControlsToCheck[spell.ControlsToCheck.Length] = String.Format("{0}_text", RadTextBox1.ClientID); 
    spell.ControlsToCheck = NewControlsToCheck; 



All the best,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 08 Jan 2009, 03:03 AM
OK.  Um, so is this for server side spell checking?  Am i miss-understanding?  I am using the RadSpell to check a RadTextBox.  Everything works fine except for when the spell check is complete.  It doesn't update in the text box until i click on the box, or give it focus.  As stated above.  I thought I could use OnClientDialogClosed="SpellCheckDone", but SpellCheckDone is not recognized.  It seems to be missing.  Isnt it suppose to be part of the embedded Javascript?   
0
Dimo
Telerik team
answered on 08 Jan 2009, 08:27 AM
Hello Karl,

The whole RadSpell + RadTextBox problem is caused by the fact that the ID of the visible textbox is not the same as the ID of the textbox, which holds the control's *real* value. The latter textbox is not visible. If you pass the RadTextBox' server id to RadSpell, RadSpell will spell the content of the invisible textbox and there is no easy way to make the visible textbox update automatically when the invisible textbox changes its value programmatically client-side.

So one possible workaround is to tell RadSpell to spell check the content of the visible textbox by passing its client ID. The example for this is provided in my previous message. Did you try that? The other option is the Javascript workaround described in the help article mentioned above. Both techniques should work for you. If not, please show us what exactly are you trying to do. Thanks.


All the best,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 08 Jan 2009, 01:05 PM

 Here are some issues I am havine!  Also, i am using Q1 2008.


1. Telerik.WebControls.RadSpell does not contain a definition for ControlsToCheck

2. radTextBox1.updateDisplayValue(); I get a benine javascript error. No object found.

 

Thanks,

0
Dimo
Telerik team
answered on 08 Jan 2009, 01:49 PM
Hello Karl,

You are writing in the RadControls for ASP.NET AJAX forum without mentioning that you are actually using the older RadControls for ASP.NET.

1. You can use the ControlToCheck property instead of ControlsToCheck. The former is a string property, while the latter is an array.

2. The client-side API of RadInput for ASP.NET is different - the UpdateDisplayValue() method should be written in PascalCase (capital first letter). And this is how to obtain a reference to the RadTextBox client-side object:

http://www.telerik.com/help/aspnet/input/clientsideapi.html


Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 08 Jan 2009, 04:29 PM

<

 

script type="text/javascript" language="javascript">

 

function

 

SpellCheckDone()

 

{

 

var RadTextBox1 = $find("<%= RadTextBox1.ClientID %>");

 

RadTextBox1.UpdateDisplayValue();

 

}

</

 

script>

this still no go!!

and what would the ControlToCheck code look like without the array??

And I thought that RadControls for Asp.Net Q1 2008 2.0 was Ajax stuff?

 

0
Karl
Top achievements
Rank 1
answered on 08 Jan 2009, 10:29 PM

The ControlToCheck thing, im not getting???


RadSpell spell = sender as RadSpell; 
    string[] NewControlsToCheck = new string[spell.ControlToCheck.Length + 1]; 
    spell.ControlToCheck.CopyTo(NewControlsToCheck, 0); 
    NewControlsToCheck[spell.ControlToCheck.Length] = String.Format("{0}_text", RadTextBox1.ClientID); 
    spell.ControlToCheck= NewControlsToCheck; 


Isnt there just a simple example of how to spell check just one RadTextBox?  It cant be that big of a deal.
This is my aspx code.

 

<rad:RadTextBox ID="RadTextBox1" Runat="server">

 

 

</rad:RadTextBox>

 

 

<br />

 

 

<rad:RadSpell ID="RadSpell1" runat="server" Skin="Default"

 

 

ControlToCheck="RadTextBox1" IsClientID="False" />

 


And i have tried changing the IsClientID to True and i get a HTML error.  All I want is for the textbox to be updated with the spell check text.  I dont get it.  What seems to be the issue.  Do you have any simple straight forward examples for this. Just the basics.  Right now everything works fine but I have to click on the textbox after the spell check window closes to get the new correctly spelled content to update.  I just want it to update when the spell check window closes.  Maybe something like focus.RadTextBox1?????
.
0
Dimo
Telerik team
answered on 10 Jan 2009, 04:20 PM
Hi Karl,

I am afraid there has been a lot of confusion here. You are writing in the RadControls for ASP.NET AJAX forum, but using the classic RadSpell for ASP.NET. Everything that I have provided as sample code in my previous messages applies to RadSpell and RadTextBox for ASP.NET AJAX.

Here is a working example for RadControls for ASP.NET:

HTML

<body> 
<form id="form1" runat="server"
 
<rad:RadSpell ID="RadSpell1" runat="server" IsClientID="true" /> 
 
<rad:RadTextBox ID="RadTextBox1" runat="server" Text="mictake" /> 
 
</form> 
</body> 
 


C#

protected void Page_Load(object sender, EventArgs e) 
    RadSpell1.ControlToCheck = String.Format("{0}_text", RadTextBox1.ClientID); 
 


Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 10 Jan 2009, 04:39 PM
Wont this just check the spelling when the page loads?  I need it to be updated, not just checked.  It checks the spelling just fine, but it wont update the box until I click on the textbox after the radspell dialog closes.
0
Karl
Top achievements
Rank 1
answered on 10 Jan 2009, 04:47 PM
<rad:RadTextBox ID="RadTextBox1" Runat="server">  
    </rad:RadTextBox> 
    <br /> 
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <rad:RadSpell ID="RadSpell1" runat="server" Skin="Default"   
        ControlToCheck="RadTextBox1" IsClientID="True"   
        ondisposed="RadSpell1_Disposed" onload="RadSpell1_Load1" /> 

protected void Page_Load(object sender, EventArgs e)  
    {  
        RadSpell1.ControlToCheck = String.Format("{0}_text", RadTextBox1.ClientID);   
    } 

I tried your code just to check, and now it updates the box ok but when i click on the text box it returns the value back to the original miss-spelled word. 
0
Dimo
Telerik team
answered on 12 Jan 2009, 08:10 AM
Hi Karl,

You are right, the textbox reverts its value to the original incorrect value onfocus, so this solution won't work. Here is what you need:


<%@ Page Language="C#" %> 
<%@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %> 
<%@ Register Assembly="RadSpell.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %> 
 
<!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"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadControls for ASP.NET</title> 
</head> 
<body> 
<form id="form1" runat="server"
 
<script type="text/javascript"
 
function UpdateTextBox(sender, args) 
    var tb = window["<%= RadTextBox1.ClientID %>"]; 
    tb.UpdateDisplayValue(); 
 
</script> 
 
<rad:RadTextBox ID="RadTextBox1" runat="server" Text="mictake" /> 
 
<rad:RadSpell 
    ID="RadSpell1" 
    runat="server" 
    ControlToCheck="RadTextBox1" 
    OnClientDialogClosing="UpdateTextBox" /> 
 
</form> 
</body> 
</html> 


Regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl
Top achievements
Rank 1
answered on 12 Jan 2009, 01:12 PM
Thank you, that did the trick.
0
Henrik Tegman
Top achievements
Rank 1
answered on 27 May 2010, 09:47 AM
Hello,

I seem to always have trouble getting a hold of the diffrent Rad components from javascript.
I read all over your forums that we should use:

window["<%= RadTextBox1.ClientID %>"];

or

$find("<%= RadTextBox1.ClientID %>")

These never work for me, I don't know why, I always get null or unidentified.
What does work sometimes is if I type something like
$find("RadTextBox1.ClientID")
Then I get back something that looks very much like a radtextbox, yet I can't use some methods like UpdateDisplayValue() or updateDisplayValue()

Right now I simply have some javascript code that change the value of a textbox and I can't get it to work unless i give the textbox focus so I thought that this was the perfect thread to find my answer yet I still can't get a hold of that box and do the UpdateDisplayValue().

Strongly considering just useing normal textbox since then it atleast works :(


0
Rumen
Telerik team
answered on 27 May 2010, 02:41 PM
Hi Henrik,

In Q1 2010 (version 2010.1.309) we introduced RadSpell compatibility with other Telerik controls (RadEditor, RadComboBox, RadTextBox). No additional code needs to be added to the page when spell-checking a RadControl. So all you need to do is to upgrade to Q1 2010 or latest version to fix the problem.

Best 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
Henrik Tegman
Top achievements
Rank 1
answered on 27 May 2010, 03:37 PM
Hi Rumen,

Maybe I didn't make myself clear, but I don't have a issue with RadSpelling, I have a problem with the RadTextBox, I have a javascriptfunction that sets the text of the RadTextBox, but the textbox doesn't get updated until I focus the RadTextBox.

To set the value of the box i use the $get('RadTextBox1').value

I know this doesn't really work since the RadTextBox is to complicated, but from what I understood it would still work if I just got it to run the UpdateDisplayValue().

But as I wrote I can't get access to the RadTextBox with the $find command.

$find('RadTextBox1') gives me null
0
Dimo
Telerik team
answered on 27 May 2010, 04:03 PM
Hi Henrik,

When using RadTextBox, you should set the value by using the control's client object and API, not $get().value.

http://www.telerik.com/help/aspnet-ajax/input_clientsidebasics.html

http://www.telerik.com/help/aspnet-ajax/input_clientsideradtextbox.html

The correct way is to use

$find("......client_id_here.....").set_value(.....);

Sincerely yours,
Dimo
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
Henrik Tegman
Top achievements
Rank 1
answered on 28 May 2010, 08:06 AM
Hi Dimo,

As I was trying to say, I already know that the $get is not the right way and that I should use the $find

BUT the $find is not working I always get back null. The only time I get some kind of an object is when i use $find without the ClientID
ie:

$find('RadTextBox1')

I just tested some more, and when useing the new set_value, it looks like it's seting the value correct I guess what I get fooled by is that when I run it in the immidiatewindow to test out the functions and try to see if I get an object when calling it with $find, it gives "undefined" or something similar in respons, but it still sets the value.

Thanks for the help, altho everytime I use RadTextBox1.ClintID i get null and when I remove the .ClientID it works, any ide why that is?
0
Dimo
Telerik team
answered on 28 May 2010, 03:00 PM
Hello Henrik,

First of all, you should make sure that you are enclosing ClientID (which is a server property) inside a server code block:

$find("<%= RadTextBox1.Client %>")

The easiest way to debug why $find() does not work is to check whether the argument that you are passing is an actualy ID of a rendered DOM element.

Second, you also have to make sure that the $find() function is not executed too early, i.e. before the textbox control client instance has been initialized:

http://blogs.telerik.com/dimodimov/posts/08-12-13/don_t_use_body_onload_in_asp_net_ajax_websites.aspx

Regards,
Dimo
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.
Tags
Spell
Asked by
tom
Top achievements
Rank 1
Answers by
George
Telerik team
Michael
Top achievements
Rank 1
Rumen
Telerik team
Karl
Top achievements
Rank 1
Dimo
Telerik team
Henrik Tegman
Top achievements
Rank 1
Share this question
or