c# - Cookies Response Issue With AutoPostBack -


I did not know how to keep the title because I could not describe the problem, here is the problem. .

(This is the only problem in the short term)

I have to say that two checkboxes set for autopost back = true

  secured zero cbPop_CheckedChanged ( Object sender, event ergues e) {response. Cookies ["User Restrictions"]. Value = request Cookies ["User Reference"]. Value + "1"; Label1.Text = Request.Cookies ["UserPreferences"]. Value.Length.ToString (); } Secure Zero cbDown_CheckedChanged (Object Sender, EventArgs e) {Response.Cookies ["UserPreferences"]. Value = Request.Cookies ["UserPreferences"]. Value + "2"; Label1.Text = Request.Cookies ["UserPreferences"]. Value.Length.ToString (); }   

What do I expect here:

I hope the text of the label will show "1" when I check the first checkbox And to show "2" when I second check box

What do I get here:

I get "1" twice, when I manually check the cookie, I think it has 12, so after checking the second check box it should be length 2, instead the label shows F its length is 1

Why is it !! Am I missing something ??

If you want to see the value after the check-change, then you need it < Strong> responses to assign to Labels .

Otherwise, the Label control will not reflect changes until next time it's posted.

See arrows in the comments area -

  Secure Zero cbPop_CheckedChanged (Object Sender, EventArgs e) {Response.Cookies ["UserPreferences"]. Value = Request cookies ["Userprints"]. Value + "1"; Label1.Text = Response.Cookies ["UserPreferences"]. Value.Length.ToString (); // ^ // | } Secure Zero cbDown_CheckedChanged (Object Sender, EventArgs e) {Response.Cookies ["UserPreferences"]. Value = Request.Cookies ["UserPreferences"]. Value + "2"; Label1.Text = Response.Cookies ["UserPreferences"]. Value.Length.ToString (); // ^ // | }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -