P
Peter Kuijt
ValidateEvent throws an argument exception when it should not:
make a new ASP.Net (2.0) web site and paste this code in Page_Load():
//-----
Button button = new Button();
button.Text = "Submit";
form1.Controls.Add(button);
Table table = new Table();
table.ID = "theName";
form1.Controls.Add(table);
HtmlInputRadioButton r1 = new HtmlInputRadioButton();
r1.ID = "R1";
r1.Name = "theName";
form1.Controls.Add(r1);
//------
The table ID and the radio button Name are the same.
Start the web site, select the radio button and click the submit button, the
trace below follows.
To my surprise this is fixed by adding the MyTable() definition:
public class MyTable : Table {
public MyTable() : base() { }
}
and replace:
Table table = new Table();
by:
Table table = new MyTable();
This looks like a bug to me...
--Peter
Trace:
[ArgumentException: Invalid postback or callback argument. Event validation
is enabled using <pages enableEventValidation="true"/> in configuration or
<%@ Page EnableEventValidation="true" %> in a page. For security purposes,
this feature verifies that arguments to postback or callback events
originate from the server control that originally rendered them. If the
data is valid and expected, use the
ClientScriptManager.RegisterForEventValidation method in order to register
the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String
argument) +367
System.Web.UI.Control.ValidateEvent(String uniqueID, String
eventArgument) +83
System.Web.UI.WebControls.Table.RaisePostBackEvent(String argument) +51
System.Web.UI.WebControls.Table.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837
make a new ASP.Net (2.0) web site and paste this code in Page_Load():
//-----
Button button = new Button();
button.Text = "Submit";
form1.Controls.Add(button);
Table table = new Table();
table.ID = "theName";
form1.Controls.Add(table);
HtmlInputRadioButton r1 = new HtmlInputRadioButton();
r1.ID = "R1";
r1.Name = "theName";
form1.Controls.Add(r1);
//------
The table ID and the radio button Name are the same.
Start the web site, select the radio button and click the submit button, the
trace below follows.
To my surprise this is fixed by adding the MyTable() definition:
public class MyTable : Table {
public MyTable() : base() { }
}
and replace:
Table table = new Table();
by:
Table table = new MyTable();
This looks like a bug to me...
--Peter
Trace:
[ArgumentException: Invalid postback or callback argument. Event validation
is enabled using <pages enableEventValidation="true"/> in configuration or
<%@ Page EnableEventValidation="true" %> in a page. For security purposes,
this feature verifies that arguments to postback or callback events
originate from the server control that originally rendered them. If the
data is valid and expected, use the
ClientScriptManager.RegisterForEventValidation method in order to register
the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String
argument) +367
System.Web.UI.Control.ValidateEvent(String uniqueID, String
eventArgument) +83
System.Web.UI.WebControls.Table.RaisePostBackEvent(String argument) +51
System.Web.UI.WebControls.Table.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837