What use is the Viewstate?

Asked

Viewed 36 times

0

In an application where I started maintenance, there are several mentions in the code. And so I would like to know what it is and also what it serves and stay more in touch with what the application does.

Here are two examples of how it is used:

List<domEstagioGrid> list = dao.ListaTodos(ViewState["WHERE"].ToString());


ViewState["COLIGADA"] = this.dgvLISTA.DataKeys[id]["CODCOLIGADA"].ToString();

1 answer

0


Not much to explain. A documentation good explanations on the ViewState and there is other content with examples and explanations.

Basically it stores data that can be used after a PostBack.

In your case it stores a value called ViewState["COLIGADA"], this value can be used on the page after the PostBack. The other that was set at some other time (ViewState["WHERE"]) is being used to send as a parameter to the method ListaTodos.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.