Hi,
I have a radspell with controlToCheck(Textbox1) in my web form..i want to activate the radspellcheck on button onclientclick event because button also have onclick event..i need to fire the radspellcheck before button onclick event...Simply i want a spellcheck on button submit...i have tried but onclick event only fired fiirst..could please some example please...
I have a radspell with controlToCheck(Textbox1) in my web form..i want to activate the radspellcheck on button onclientclick event because button also have onclick event..i need to fire the radspellcheck before button onclick event...Simply i want a spellcheck on button submit...i have tried but onclick event only fired fiirst..could please some example please...
4 Answers, 1 is accepted
0
Accepted
Hello,
You need to cancel the postback, let the spellcheck work and initiate the postback again when it finishes. Otherwise, the postback will dispose the spell because it works on the client.
There are various ways to do this and perhaps this KB article will help you with one approach: http://www.telerik.com/support/kb/aspnet-ajax/spell/details/invoke-separate-spell-check-for-each-textbox-and-submit-the-form-on-success.
Another suggestion is to use the client-side API and events of the control:
- to know when the check finishes: http://www.telerik.com/help/aspnet-ajax/spell-client-check-finished.html.
- to see how to invoke it from a client-side function you have: http://www.telerik.com/help/aspnet-ajax/spell-how-to-launch.html.
For your convenience I prepared a small example here:
<asp:TextBox ID=
"Textbox1"
runat=
"server"
Text=
"miztakes"
/>
<telerik:RadSpell ID=
"RadSpell1"
runat=
"server"
ControlToCheck=
"Textbox1"
ButtonType=
"None"
OnClientCheckFinished=
"invokePostback"
/>
<asp:Button ID=
"Button1"
Text=
"check and submit"
OnClientClick=
"invokeSpellCheck(this); return false;"
OnClick=
"Button1_Click"
runat=
"server"
/>
<script type=
"text/javascript"
>
function
invokeSpellCheck(btn) {
var
spell = $find(
"<%=RadSpell1.ClientID %>"
);
spell.__customButtonReference = btn;
spell.startSpellCheck();
}
function
invokePostback(sender, args) {
if
(sender.__customButtonReference) {
__doPostBack(sender.__customButtonReference.getAttribute(
"name"
),
""
);
}
}
</script>
Regards, Marin Bratanov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Jul 2014, 09:36 AM
Hi Karthik,
Please try to attach the OnClientDialogClosed event of RadSpell and try to call the OnClick event of RadButton from OnClientDialogClosed event as follows and also set the AutoPostBack property of RadButton as false.
JavaScript:
Thanks,
Shinu.
Please try to attach the OnClientDialogClosed event of RadSpell and try to call the OnClick event of RadButton from OnClientDialogClosed event as follows and also set the AutoPostBack property of RadButton as false.
JavaScript:
function
finishCheck(sender, args) {
button = $find(
"<%=rbtnSpellCheck.ClientID%>"
);
__doPostBack(button.get_id(),
"OnClick"
);
}
Thanks,
Shinu.
0
karthik
Top achievements
Rank 1
answered on 17 Jul 2014, 12:14 PM
Hi Shinu,
Thank you so much...it works fine...
Thank you so much...it works fine...
0
karthik
Top achievements
Rank 1
answered on 17 Jul 2014, 12:15 PM
hi Marin Bratanov,
Thank you so much for the sample..It works after adding the Shinu point...
Thank you so much for the sample..It works after adding the Shinu point...