If you want to save the state on the server, you can save the state in a hidden field accessible to the server and access this field during postback and save the state in which you want. If you want to keep state on the client, you can use client storage
In html
<input type="hidden" runat="server" id="hdnstate" />
In javascript
document.getElementById('<%= hdnstate.ClientId %>').value = "stateinfo";
In the code below
string strState = hdnstate.Value;
source share