If you use ASP.NET with some jQuery, you can set the value of the hidden field in the message. Then in $ (document) .ready () you just read that value from a hidden field.
In your code behind:
protected void Button1_Click(object sender, EventArgs e)
{
this.countryField.Value = "WhateverValueYouWantToPersist";
}
In your aspx file:
$(document).ready(function(){
var persistedValue = <% this.countryField.ClientID %>;
});
<asp:HiddenField runat="server" ID="countryField" />
Update:
. , /.
aspx :
<asp:DropDownList runat="server" ID="countryField" />
<asp:DropDownList runat="server" ID="stateField" />
<asp:Button runat="server" ID="button1" OnClick="button1_click" OnClientClick="return clientSideClick()" />
<asp:HiddenField runat="server" ID="hiddenCountry" />
<asp:HiddenField runat="server" ID="hiddenState" />
jQuery , :
function clientSideClick() {
var state = $("#<%= this.stateField.ClientID %> :selected").val();
$("#<%= this.hiddenState.ClientID %>").val(state);
var country = $("#<%= this.countryField.ClientID %> :selected").val();
$("#<%= this.hiddenCountry.ClientID %>").val(country);
}
, :
protected void button1_click(object sender, EventArgs e)
{
string stateValue = this.hiddenState.Value;
string countryValue = this.hiddenCountry.Value;
}
/, , jQuery ajax, - , .