View Full Version : [CLOSED] Change event triggers when textfield modified in code-behind

Nov 26, 2013, 11:40 AM
Hi there, I have setup a textfield on a form with a direct event triggering when field changes. I was expecting this event to trigger only when user changes the value manually on browser. Then I realized that if I change textfield value on code behind, the change trigger triggers the same. Is it there a way to disable trigger when textfield is modified at server side? I tried adding "return false;" to Before property of the event before assigning value but it did not work.

Nov 26, 2013, 3:40 PM
Hi @jstifel,

Yes, the Change event fires on any change.

You can suspend the event on demand.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Set(object sender, DirectEventArgs e)
this.TextField1.Text = "test";

<!DOCTYPE html>
<head runat="server">
<title>Ext.NET v2 Example</title>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:TextField ID="TextField1" runat="server">
<Change Handler="console.log('change');" />

<ext:Button runat="server" Text="Set" OnDirectClick="Set" />

Nov 26, 2013, 6:13 PM
Ok, I tried to call the SuspendEvent method finding there is only available one called SuspendEvents. I tried instead using this one and everything worked OK. I guess I may be running an older version of the library which does not include the SuspendEvent method. Anyway I solved the issue. Thank you very much.
You can close the case now.

Nov 27, 2013, 3:04 AM
Yes, the SuspendEvent appeared not so far ago.