Originally Posted by
Daniil
Hi,
Here you are.
Example
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
[DirectMethod]
public void Test(string buttonId, string text)
{
X.Msg.Alert("DirectMethod", buttonId + "<br/>" + text).Show();
}
</script>
<!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">
<title>Ext.NET Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Prompt">
<Listeners>
<Click Handler="Ext.Msg.prompt('Title', 'Message', function (buttonId, text) {
Ext.net.DirectMethods.Test(buttonId, text);
});" />
</Listeners>
</ext:Button>
</body>
</html>
Hi Daniil,
Thanks for the reply.
Actually, I need to put the click handler in the codebehind, because I'm doing some actions in the code before show the Ext.Msg.Prompt. I tried to do that, but didn't work.
Here my code, please help me to correct the call.
Code to call the msg in codebehind:
X.Msg.Prompt("Mensagem ao Colaborador", "Informe a mensagem a ser enviada ao colaborador", new JFunction { Handler = String.Format("Ext.net.DirectMethods.EnviarMensagem({0});", Request.Params["text"]) }).Show();
[DirectMethod]
public void EnviarMensagem(string texto)
{
//here the action....
}