when we click the button ,It will aotu running the DirectEvent;Can I do something such as :Made a Judgment on server,if ture then run the DirectEvent,Otherwise don't do anything?
Printable View
when we click the button ,It will aotu running the DirectEvent;Can I do something such as :Made a Judgment on server,if ture then run the DirectEvent,Otherwise don't do anything?
Hi,
You can prevent a DirectEvent on client side returning false from its Before handler.
I'm afraid I don't understand the requirement.
Do you need a separate request to server to determine should DirectEvent be fired or not?
What about checking the condition withing a DirectEvent handler and do some actions or do not?
I mean to organize the things something like this.
Example
Code:<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void TestDirectEventHandler(object sender, DirectEventArgs e)
{
bool someCondition = true; //this is your judgement
if (someCondition)
{
X.Msg.Alert("DirectEvent", "Hello from Server!").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>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Test" OnDirectClick="TestDirectEventHandler" />
</form>
</body>
</html>