CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> .NET

 using viewstate

Print topic Send  topic

Author Message
D. Lewis
Posted: 07/07/2004, 3:59 PM


I am having a problem using ViewState in my pages.

The code looks something like the following in an button's onclick event:

dim errormessages string
dim sql as string

sql ="Some SQL code"



catch ex as

ViewState("DBError") = "Database Error Occurred"

end try

I then try to retrieve the viewstate as follows in the page's onload event

lblError.Text = "Errors: " & CStr(ViewState("DBError"))

When the page is displayed the text of lblError is "Errors:". But the value from the ViewState is never retrieved.

I am sure that an exception is occuring because i get page error when i remove the try ... catch block. I am sure that the exception is of the type OleDbException and that the exception is being caught because i am able to redirect to a new page in the same try ... catch block.

As anyone familiar with the proper usage of viewstate in codecharge. I have use ViewState before in other non-codecharge projects, but am having very little success in codecharge.

Any help or ideas would be greatly appreciated.

Posted: 07/07/2004, 11:31 PM


The OnClick event in CCS is ended with Response.Redirect, and ViewState not persisted during HTTP redirect. In you case i can suggest following methods

1. Using Session instead the ViewState
2. In case if button has not operation (Insert, Update Delete), add to the Catch clause
ErrorFlag = True
3. In case if button has some assigned operation add following code to the Catch
<formName>Operations.Allow<OperationName> = False
' for example tasksOperations.AllowInsert = False
ErrorFlag = True

The last 2 methods will disable redirect after OnClick event

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.