EnableEventValidation=false causes unexpected behaviour
Please consider the code below in the recently released Coolite 0.8 framework (works perfectly in Coolite 0.7).
When EnableEventValidation is set to 'false', clicking on the button will make the TextField disappear after the AsyncPostBack.
When its set to true, nothing strange occur.
Code:
<%@ Page Language="C#" EnableEventValidation="false" ValidateRequest="false" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!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>
<title></title>
</head>
<body style="overflow: auto;">
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="ScriptManager2">
</asp:ScriptManager>
<ext:ScriptManager ID="ScriptManager1" runat="server">
</ext:ScriptManager>
<ext:ViewPort ID="ViewPort1" runat="server">
<Body>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<North>
<ext:Panel runat="server">
<Body>
<asp:UpdatePanel runat="server" ID="updMain">
<ContentTemplate>
<ext:TextField ID="txtSearchOld" runat="server" Width="270px" CtCls="txtSearch" EmptyText="empty text"
FieldClass="txtSearch">
</ext:TextField>
<asp:Button ID="Button1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</Body>
</ext:Panel>
</North>
<Center>
<ext:Panel runat="server">
</ext:Panel>
</Center>
</ext:BorderLayout>
</Body>
</ext:ViewPort>
</form>
</body>
</html>
RE: EnableEventValidation=false causes unexpected behaviour
I was able to reproduce the issue, although have not been able to find a fix. The controls lifecycle is functioning differently with EnableEventValidation="false" and we'll have to spend some more time debugging.
It's generally not recommended to set EnableEventValidation="false", so I was just wondering what scenario requires this setting?
RE: EnableEventValidation=false causes unexpected behaviour
The most common scenario i've experienced so far is the one when a user is typing the charachter "<" in a TextBox, when EnableEventValidation=true.
This will result in "Invalid Postback or Callback argument"
see more here: http://niravbhattsai.blogspot.com/20...-argument.html
as i said before - everything was ok until Coolite 0.8... what changed?
RE: EnableEventValidation=false causes unexpected behaviour
Hi omeriko9,
I solved adding Vtype to the textbox control. That occured also with the 0.7 release.
It happens with charachters "<" ">".
If it is valid in your scenario, use the code below.
In my case end user can't insert these characters.
Code:
<ext:TextField ID="TE_Text" Vtype="apici" AllowBlank="false"
BlankText="required field" FieldLabel="Label" runat="server" />
JS code
Ext.form.VTypes['apiciVal'] = /^[^<>]*$/;
Ext.form.VTypes['apiciMask'] = /^[^<>]*$/;
Ext.form.VTypes['apiciText'] = 'invalid charachters';
Ext.form.VTypes['apici'] = function(v) {
return Ext.form.VTypes['apiciVal'].test(v);
}
Hope it helps
Matteo
RE: EnableEventValidation=false causes unexpected behaviour
Hi methode,
thank you for your solution, i will definitely use it.
My problem is not how to prevent the user from using any "<" in the TextBox (Actually, i would like to let him user those chars because he might post some xml).
The two main reasons i need to use EnableEventValidation=false are heavy manipulation of elements using client script, and the use of __doPostBack().
RE: EnableEventValidation=false causes unexpected behaviour
Another common scenario for using EnableEventValidation=false is implementation of row select in a asp:GridView with a click on the row, following this article :
http://www.geekzilla.co.uk/view9FC28...B0B10134D5.htm
and then hiding the "select" button.
RE: EnableEventValidation=false causes unexpected behaviour
Another issue we've encountered when EnableEventValidation = false is that popup windows are not shown.
Here is a simple example you can use to test this scenario:
file:aspx
Code:
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:linkbutton id="lnkActions" runat="server">Actions</asp:linkbutton>
</ContentTemplate>
</asp:UpdatePanel>
<cool:Window ID="ActionsWindow" runat="server" Height="480px" Width="700px">
<Body>
hello
</Body>
</cool:Window>
file: aspx.cs
Code:
override protected void OnInit(EventArgs e)
{
lnkActions.Click += new EventHandler(lnkActions_Click);
base.OnInit(e);
}
void lnkActions_Click(object sender, EventArgs e)
{
Actionswindow.Show();
}
RE: EnableEventValidation=false causes unexpected behaviour
Hi guys,
anything new here, good or bad?