Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:05:42+00:00 2026-05-26T10:05:42+00:00

Just small question as I cannot find an answer that resolves my problem. I

  • 0

Just small question as I cannot find an answer that resolves my problem.

I have an ASP page which sends input to a database and then creates a session. I would like to know how to return a certain value in that session on another aspx page.

page1.aspx.cs [creates session]

public partial class new_questionnaire : System.Web.UI.Page
    {
        OscarSQL c;

            protected void Page_Load(object sender, EventArgs e)
            {  
                c = new OscarSQL();
            } // End Page_Load

            //////    Button Method    //////        
            protected void NewQnrButton_Click(object sender, EventArgs e)
            {
                // Check if the input fields are empty.
                if (QuestionnaireName.Text == "" || CustomerID.Text == "" || NumberOfQuest.Text == "")
                {
                    Error.Text = "Please enter a name for your questionnaire.";
                }
                // Parse input values to OscarSQL.
                else
                {

                    int testRet = c.InsertQuestionnaire(QuestionnaireName.Text, Int32.Parse(CustomerID.Text), Int32.Parse(NumberOfQuest.Text));
                    Session["Questionnaire"] = testRet;
                    Confirm.Text = "Your questionnaire has been named " + QuestionnaireName.Text;
                    Response.Redirect("~/add_questions.aspx");
                }

            } // End NewQNRButton_Click

        } // End new_questionnaire

Page2.aspx.cs [Would like value to be parsed here]

namespace OSQARv0._1
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //ReturnQnrName.Text here?

        }
    }
}

I would like the value QuestionnaireName.Text from Page1 to be returned to ReturnQnrName.Text on Page2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:05:42+00:00Added an answer on May 26, 2026 at 10:05 am

    You didn’t put QuestionnaireName.Text into Session on Page1, you put an integer. If you need the actual text property, put that into session

    Session["theText"] = QuestionnaireName.Text;
    

    And then you can retrieve it

    string text = (string)Session["theText"]; 
    

    This reveals something about Session. Objects are stored of type object, you need to cast them to their correct types once you retrieve them before use. For example, to retrieve the integer you put into Session, you would write

    int questionnaire = (int)Session["Questionnaire"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a small question regarding joins. I have a table with around 30 fields
Just to preface: I work in a small company that does ASP.NET development and
I am new to Shell script. Just have a small question about some script
Just a small SVN problem here. I setup my own SVN server Setting up
Ok guys just a small game: I have some specifications for a project. At
I've just written a small XBox 360 Wireless Controller managed interface that basically wraps
It seems that a lot of small business people have a need for some
I have a straightforward question. I am doing a web application that uses MySQL,
There is a term for this that I just cannot think of, and I'm
I have a small question about stored procedures and the DateTime2 datatype in SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.