ho modificato il js così e non ho l'errore e vedo l'ok:
codice:
<script type="text/javascript">
document.getElementById('testo').onkeydown = function (e) {
if (e.keyCode == 13) {
var f = document.getElementsByTagName("form");
f[0].submit();
}
};
</script>
però la funzione legata al bottone non viene eseguita.
che sarebbe questa:
codice:
Protected Sub btnInviaRichiesta_Click(sender As Object, e As EventArgs) Handles btnInviaRichiesta.ServerClick
If Not String.IsNullOrEmpty(testo.Value) Then
oConn.Open()
Dim cmd As SqlCommand = New SqlCommand("[usp_InsertRichiestaMsg]", oConn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Clear()
cmd.Parameters.AddWithValue("@MsgRicId", ricId)
cmd.Parameters.AddWithValue("@MsgStatus", 0)
cmd.Parameters.AddWithValue("@MsgDestinatario", dest)
cmd.Parameters.AddWithValue("@MsgTipoUtente", "R")
cmd.Parameters.AddWithValue("@MsgTesto", testo.Value)
cmd.ExecuteNonQuery()
oConn.Close()
End If
Response.Redirect(HttpContext.Current.Request.Url.ToString(), True)
End Sub