2
Answers

autopostback and the back button

Photo of usinglogic

usinglogic

20y
2.2k
1
hi all, i was wondering for somebody could help me out...so i'm using a dropdownlist, checkboxlist, with autopostback = true...i'm populating the boxlist with data against a ms sql server...the problem i'm having is that when i select a new item in the dropdown or checkbox, it post a new page with the updated changes to the dropdown/checkbox...so when i click the "back button" on the browser it would simply take me back to the previous dropdown item and not the previous page...so i do i get around this problem...if anybody can give me some suggestions, it will definitely make my day...thanks

Answers (2)

1
Photo of Ramesh Palaniappan
NA 13.2k 722.6k 8y
Try to give Session value before insert like below.
  1. try
  2. {
  3. Session["Vechilevalue"]=DropDownList1.SelectedValue;
  4. if(Session["Vechilevalue"]!=null&&!n.tbl_Vec.Any(x=>x.Vec_ID==Vec_ID))
  5. {
  6. v.Vec_ID=Vec_ID;
  7. {
  8. v.Vec_ID=DropDownList1.SelectedValue;
  9. }
  10. n.tbl_Vec.Add(v).ToString();
  11. n.SaveChanges();
  12. }
  13. else
  14. {
  15. }
  16. }
  17. catch
  18. {
  19. }