Solved

form using two placeholders and the visible function error Invalid Post Back

Posted on 2008-06-10
1
344 Views
Last Modified: 2012-08-14
I have a page asc.aspx this page has two placeholders (frmasc_search & frmasc_results) the first is visible on page load  and the other is not. When I press a button I want the first form to change to invisible and the second to be visible. However when I do this I am getting an error for Invalid Post Back. What do I need to do. I have included the full text of the error and the script I am running below.
---- Error Message ----

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. 

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(String uniqueId, String argument) +159

   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108

   System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +36

   System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +12

   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +353

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194
 

---- Script ----

 <script runat="server">

Sub Page_Load (sender As Object, e As EventArgs)

ph_asc_search.visible = true

ph_asc_results.visible = false

End Sub

Sub brtnsearch_Click(sender As Object, e As EventArgs)

ph_asc_search.visible = false

ph_asc_results.visible = true

End Sub

</script>

Open in new window

0
Comment
Question by:woodje
1 Comment
 
LVL 12

Accepted Solution

by:
renjurdevan earned 500 total points
ID: 21758081
Try

Sub Page_Load (sender As Object, e As EventArgs)
if  Not Ispostback() Then
ph_asc_search.visible = true
ph_asc_results.visible = false
End if
End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I use this extension method? 8 47
Align Buttons next to each other 2 25
Remove greater than sign 3 45
ASP.NET 5 Templates 2 66
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now