Pregunta

Estoy tratando de utilizar RadSpell Telerik realizar la revisión ortográfica algo de texto cuando el usuario lo presenta.

La forma en que se supone que funciona es deteniendo la devolución de datos, lo que provocó la revisión ortográfica a través de JavaScript, a continuación, en caso spellcheckfinished el inicio manual de la devolución de datos real. El problema es que en la última etapa del evento clic no está disparando para el botón y el controlador de eventos del lado del servidor nunca se llama.

Aquí está el código .aspx correspondiente:

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

    var spellCheckFinished = false;
    var btnClicked;

    function doSpellCheckStuff(btnTrigger) 
    {          
        btnClicked = btnTrigger;
        var spell = GetRadSpell('<%= rsMessage.ClientID %>');
     //   spell.add_clientCheckFinished(checkFinished);
        spell.startSpellCheck();
        return false;
    }

    function checkFinished(sender, args)
    {   
        args.SuppressCompleteMessage = true;
        setTimeout('MySubmit();', 100);
    }

    function MySubmit()
    {
        WebForm_DoPostBackWithOptions(
            new WebForm_PostBackOptions(btnClicked.id, '', true, '', '', false, true)
        );
    }
</script>

<tr>
            <td>
                <asp:Button ID="btnSubmit" OnClientClick="return doSpellCheckStuff(this);" Text="Submit" 
                            OnClick="btnSubmit_Click" runat="server" />
            </td>
            <telerik:RadSpell   ID="rsMessage" ControlToCheck="txtMessage" ButtonType="None" 
                                UseClassicDialogs="true" FragmentIgnoreOptions="All" 
                                OnClientCheckFinished="checkFinished" runat="server" />
        </tr>

Cualquier idea de por qué btnSubmit_Click no está recibiendo llamadas y cómo puedo solucionarlo?

¿Fue útil?

Solución

Trate de inyectar la secuencia de comandos de devolución de datos como:

string script = @"function MySubmit(){" +
                  this.Page.ClientScript.GetPostBackEventReference(myButton, string.Empty);
                  "}";

if (!this.Page.ClientScript.IsClientScriptBlockRegistered("myPostBackScript"))
{
    this.Page.ClientScript.RegisterClientScriptBlock(typeof(MyPage), "myPostBackScript", script, true);
}

Otros consejos

El último como de doSpellCheckStuff () está volviendo falso siempre, que detiene el detector de eventos OnClick se ejecute.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top