I want to have a button which opens up a new window when pressed.
Expand|Select|Wrap|Line Numbers
- <asp:Button ID="Button1" runat="server" Text="Open new window" />
- ...
- Button1.Attributes.Add("OnClick",
- "window.open(' ... ', null, ' ... ');return false;");
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.
[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif] Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.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.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack 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(St ring uniqueId, String argument) +8620921
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +72
System.Web.UI.WebControls.TextBox.LoadPostData(Str ing postDataKey, NameValueCollection postCollection) +34
System.Web.UI.WebControls.TextBox.System.Web.UI.IP ostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +14
System.Web.UI.Page.ProcessPostData(NameValueCollec tion postData, Boolean fBeforeLoad) +346
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
[/FONT]
On the other hand if I use a link instead of a button, it would work fine:
Expand|Select|Wrap|Line Numbers
- <a href="..." target="_blank" title="Upload" onclick="window.open(this.href, null, ' ... '); return false;">Open new window</a>
Setting EnableEventValidation to false might solve this and I don't mind using links instead of buttons; but does anyone know the cause of this?
Thanks a lot :)