CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> .NET

 using viewstate

Print topic Send  topic

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

Hello,

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"

try

Settings.onnection1DataAccessObject.RunSql(sql)

catch ex as system.data.oledb.oledbexception

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.

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

Hi

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
Stan

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 http://support.yessoftware.com.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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