Home > Net >  Asp.net how to call the class file view state (online, etc.)
Asp.net how to call the class file view state (online, etc.)

Time:09-22

Asp.net how to call the class file view state?
In "page. Aspx. Cs" call no problem
But directly in the class file "of" class. Cs call is not possible, should be how to call?

CodePudding user response:

Can consider to give you the content of the view state is passed as a parameter of the class, view state use premise is need a runat=server tags on a page of the server controls
https://bbs.csdn.net/topics/20237945? page=2

CodePudding user response:

Is really a "old problem", it is basically the most suitable for 2005 years ago, when the development peak of asp.net controls, suddenly let a person mentally, to recall old memories,

The so-called "class file", I assume that you are not "to technology and technology" concept, but your business logic to handle the BLL method is called a "class file"!!!! Should handle business nature is realized with the UI, especially with a very special, very rare UI layer separation, the UI layer code to the specific Page on the server side in various events, capture the front-end request trigger demand, in the event of your UI server-side code calls the BLL layer business object processing method, then the input data is your event handling code is responsible for obtain from view state, and to the business processing function method, put the cart before the horse can interfere with the system design, eventually making development out of control,

CodePudding user response:

When designing business processing objects and methods, "should not be completely what view state associated concepts such as", pay attention to the interface design, pay attention to who rely on, the UI layer depends on the BLL, instead of putting the cart before the horse,

Programming is also very simple, there are some difficulty, the difficulty is that some people always put the cart before the horse, at first, and do not understand architectural design principles, with 5 years can change (some even 15 years can change).

CodePudding user response:

1 see. Aspx. Cs derived classes? The page and inherit the page control, see
 protected virtual StateBag view state {get; } 


2 class. Why cs operation view state?

CodePudding user response:

View state is a dictionary table, want how to do how to do ah,

CodePudding user response:

Is curious, the building Lord you why want to use view state class to read?

CodePudding user response:

In the httpcontext find

https://kb.kutu66.com/CSharp/post_12820133

Things are too old, we cannot guarantee that this code is right, but something is definitely in the httpcontext to is true

CodePudding user response:

View state is page (page) level.. If you are involved in the class with static variables directly or session line are seldom used in class

CodePudding user response:

Can't pass in