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

  • Home
  • SEARCH
  • 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 6842095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:03:23+00:00 2026-05-27T00:03:23+00:00

I have login page, once logged in I create a session variable to store

  • 0

I have login page, once logged in I create a session variable to store the UserName.
I’ve used this variable to retrieve info for this User from Account table with AccountID, name etc and I return the AccountID on the page using a label (lblAccountID).

I have a button to “Add Funds” to this account, which redirects to the AddFunds.aspx page

How can I pass the AccountID into the AddFunds.aspx page which will be used to insert details into Funds table which has the AccountID.

I don’t want the AccountID to be visible on the AddFunds.aspx page.

  • 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-27T00:03:24+00:00Added an answer on May 27, 2026 at 12:03 am

    there are multiple ways to achieve this. i can explain you in brief about the 4 types which we use in our daily programming life cycle.

    Please go through the below points.

    1 Query String.

    FirstForm.aspx.cs

    Response.Redirect(“SecondForm.aspx?Parameter=” + TextBox1.Text);
    

    SecondForm.aspx.cs

    TextBox1.Text = Request. QueryString["Parameter"].ToString();
    

    This is the most reliable way when you are passing integer kind of value or other short parameters.More advance in this method if you are using any special characters in the value while passing it through query string, you must encode the value before passing it to next page. So our code snippet of will be something like this:

    FirstForm.aspx.cs

    Response.Redirect(“SecondForm.aspx?Parameter=” + Server.UrlEncode(TextBox1.Text));
    

    SecondForm.aspx.cs

    TextBox1.Text = Server.UrlDecode(Request.QueryString["Parameter"].ToString());
    

    2. Passing value through context object

    Passing value through context object is another widely used method.

    FirstForm.aspx.cs

    TextBox1.Text = this.Context.Items["Parameter"].ToString();
    

    SecondForm.aspx.cs

    this.Context.Items["Parameter"] = TextBox1.Text;
    Server.Transfer(“SecondForm.aspx”, true);
    

    Note that we are navigating to another page using Server.Transfer instead of Response.Redirect.Some of us also use Session object to pass values. In that method, value is store in Session object and then later pulled out from Session object in Second page.

    3. Posting form to another page instead of PostBack

    Third method of passing value by posting page to another form. Here is the example of that:

    FirstForm.aspx.cs

    private void Page_Load(object sender, System.EventArgs e)
    {
    buttonSubmit.Attributes.Add(“onclick”, “return PostPage();”);
    }
    

    And we create a javascript function to post the form.

    SecondForm.aspx.cs

    function PostPage()
    {
    document.Form1.action = “SecondForm.aspx”;
    document.Form1.method = “POST”;
    document.Form1.submit();
    }
    TextBox1.Text = Request.Form["TextBox1"].ToString();
    

    Here we are posting the form to another page instead of itself. You might get viewstate invalid or error in second page using this method. To handle this error is to put EnableViewStateMac=false

    4. Another method is by adding PostBackURL property of control for cross page post back

    In ASP.NET 2.0, Microsoft has solved this problem by adding PostBackURL property of control for cross page post back. Implementation is a matter of setting one property of control and you are done.

    FirstForm.aspx.cs

    <asp:Button id=buttonPassValue style=”Z-INDEX: 102″ runat=”server” Text=”Button”         PostBackUrl=”~/SecondForm.aspx”></asp:Button>
    

    SecondForm.aspx.cs

    TextBox1.Text = Request.Form["TextBox1"].ToString();
    

    In above example, we are assigning PostBackUrl property of the button we can determine the page to which it will post instead of itself. In next page, we can access all controls of the previous page using Request object.

    You can also use PreviousPage class to access controls of previous page instead of using classic Request object.

    SecondForm.aspx

    TextBox textBoxTemp = (TextBox) PreviousPage.FindControl(“TextBox1″);
    TextBox1.Text = textBoxTemp.Text;
    

    As you have noticed, this is also a simple and clean implementation of passing value between pages.

    Reference: “How to: Pass Values Between ASP.NET Web Pages“

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a (HTTPS) login.php page which remains HTTPS (ie once user logged in
I have a login page where once a user is logged in successfully it
I have a login page and once a person is logged in , he
i have a login page so once the user enters the correct details he
I have a login.jsp page which contains a login form. Once logged in the
Normally we have login page with username, password filed and signin button. Using the
I have a login page where I authenticate the user. When the authentication pass,
I have created a user login page and am using Forms Authentication. Users are
I have this situation: There are a login page with a login form (form
I'm creating a login page. I want to create ASP.NET TextBox controls that have

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.