Home > Enterprise Portal > Use of ViewState in User control

Use of ViewState in User control

During development of user controls in EP, if  you wish to preserve the state(value) of  Page Level variables , you can use ViewState available in EP Framework in Ax2009. This is useful because Enterprise portal by default is stateless and if data  need to persisted across various postbacks events  in web control for example in a Dataset, ViewState comes as a handy option.

Scenario :  When a button is clicked on user control or user goes to next page in a Web control which uses a wizard , then a postback event is fired and value of page level variables is lost.

Usage : Use the following code to store the variable under ViewState

 ViewState[“InvoiceId”] = invoiceId; 

And to retrieve the value , use code below

invoiceId = ViewState[“InvoiceId”]

Advertisements
Categories: Enterprise Portal
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: