locked
session variable RRS feed

  • Question

  • User379532407 posted

    Hi there

    could someone tell me what's wrong with this code? the last line is bringing up errors in visual studio.

    string selectvalueid = e.CommandArgument.ToString();

                    if (Session["lnkvalue"] != "")

                        do
                        {
                            Label2.Text = "Warning: You are currently creating a report for this merchant";

                        } while (selectvalueid = Session("lnkvalue"));


    Thanks,

    Laura

    Monday, March 15, 2010 1:34 PM

Answers

  • User-1360095595 posted

    Try using [] instead of () for accessing session items.  Also, you want to use == instead of =.  So:  while (selectvalueid == Session["lnkvalue"]);

    One last thing...  If selectvalueid is equal to the session value, how will you ever get out of this loop?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 15, 2010 3:32 PM
  • User1358036820 posted

    You have your brackets crossed.  Use [] for sesion and the equals should be == as you are comparing the value. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 15, 2010 3:33 PM

All replies

  • User-1360095595 posted

    Try using [] instead of () for accessing session items.  Also, you want to use == instead of =.  So:  while (selectvalueid == Session["lnkvalue"]);

    One last thing...  If selectvalueid is equal to the session value, how will you ever get out of this loop?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 15, 2010 3:32 PM
  • User1358036820 posted

    You have your brackets crossed.  Use [] for sesion and the equals should be == as you are comparing the value. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 15, 2010 3:33 PM