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 9235587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:05:08+00:00 2026-06-18T07:05:08+00:00

In edmx page I have button control with event NextButton_Click for click. When I

  • 0

In “edmx” page I have button control with event “NextButton_Click” for click. When I click this button the variables “index” doesn’t want to change to “40” and the “text”
variable doesn’t want to change to “active”. These variables are always in the same state “text” is always equal to “start” and “index” is always equal to “10”. Why they don’t want to change with (index = 40;
text = “active”;) as I wrote in the click button event method ?

public partial class CountriesTowns : System.Web.UI.Page
{
    int index = 10;
    string text = "start";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            index = 20;
            text = "stop";
        }
    }

    //click next button
    protected void NextButton_Click(object sender, EventArgs e)
    {   
        Response.Write(index);
        Response.Write(text);
        index = 40;
        text = "active";
    }
  • 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-06-18T07:05:09+00:00Added an answer on June 18, 2026 at 7:05 am

    HTTP is stateless, every object like your index or text(and even all controls) are destroyed at the end of the page’s life-cycle. So they are always initialized with their default value.

    int index = 10;
    string text = "start";
    

    You can use a control(f.e. a TextBox or a HiddenField) to persist their value across postbacks.

    But there are other options:

    Nine Options for Managing Persistent User State in Your ASP.NET Application

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

Sidebar

Related Questions

I have this edmx model (see below) and I would like to add an
I have a legacy EDMX-based EF model, and a newer CodeFirst model. I want
I have a model edmx model and am using POCO like this: public class
I have an edmx file that reflects 100% my DB schema. Along with this
I have a Model1.edmx, which has several tables. Now, I do not want all
So I have my edmx made. Then I change my database a little bit,
I have this EF database-first EDMX file that I created it with a local
What I'm trying to do:- Index page would have a dropdown of say categories,
I have created an EDMX in visual studio 2010 SP1. It has been built
I have an edmx model which I have draged 2 tables onto - One

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.