[VIEWED 5564
TIMES]
|
SAVE! for ease of future access.
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 9:34
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I need to restore first and lastname from cookie, please help. I am able to retreive the firstname, but can't get it to work when it comes to retrieving the second field (lastname). Here is what I have working for the first field: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) if (!(Request.Cookies["FirstName"] == null)) txtFirstName.Text = Request.Cookies["FirstName"].Value; Thanks
|
|
|
|
NepaliCR7
Please log in to subscribe to NepaliCR7's postings.
Posted on 11-10-16 10:03
AM [Snapshot: 22]
Reply
[Subscribe]
|
Login in to Rate this Post:
1
?
Liked by
|
|
add your second field to cookie and retrieve it using same way you doin for first field.
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 10:28
AM [Snapshot: 55]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
How do I go about including the second field? Do I need to create another Load? Need format plz
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 12:25
PM [Snapshot: 107]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 1:03
PM [Snapshot: 150]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 1:09
PM [Snapshot: 151]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Getting an error on line 34 now. I need the check out page to restore fname and lname. It worked using the first code for first field, but doesn't seem to work for the second field.
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 1:14
PM [Snapshot: 157]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
After selecting continue it will go to check out page with items in cart. Next page also has btn that allows me to go back which is supposed to restore cached fname and lname and display it on respective fields. The problem I seem to have is that it only seems to work for the fname field
|
|
|
guitarcenter
Please log in to subscribe to guitarcenter's postings.
Posted on 11-10-16 1:59
PM [Snapshot: 180]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Check the property of the textboxes. Enableviewstate set to True. Lets see if that solves the state issue
|
|
|
NepaliCR7
Please log in to subscribe to NepaliCR7's postings.
Posted on 11-10-16 2:00
PM [Snapshot: 182]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
add {} braces when checking for cookies is null or not. when you load you page at first the cookies are not set that's why you are gettin that exception. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) if (!(Request.Cookies["FirstName"] == null) && !(Request.Cookies["LastName"] == null)) { TextBox1.Text = Request.Cookies["FirstName"].Value; TextBox2.Text = Request.Cookies["LastName"].Value; } }
|
|
|
NepaliCR7
Please log in to subscribe to NepaliCR7's postings.
Posted on 11-10-16 2:01
PM [Snapshot: 186]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Also, remember if you have more than one line of code in you if ALWAYS PUT CURLY BRACES around if.
|
|
|
user01
Please log in to subscribe to user01's postings.
Posted on 11-10-16 2:09
PM [Snapshot: 189]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Many Many thanks to everyone. {} did the trick. Thanks again.
|
|
|
guitarcenter
Please log in to subscribe to guitarcenter's postings.
Posted on 11-10-16 2:09
PM [Snapshot: 200]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Yes cr7. There is no curly braces so its just taking one line after the condition. Lol
|
|
|