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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:39:35+00:00 2026-06-03T13:39:35+00:00

I am a beginner developer .. I need help .. please see the following

  • 0

I am a beginner developer .. I need help .. please see the following example .. sorry for poor english …

I have a string variable called str assigned with “John”. I changed it to “Dave” when the first button is clicked. When the second is clicked, I displayed the value to a label. I wanna see Dave but I just see John. Why is that?

There is nothing on page load and nothing else where. I know I can put into a session but this is on the same page. Can I not do without session or viewstate.

Thanks.

    Partial Class  _Default
        Inherits System.Web.UI.Page

        Private str As String = "John"

        Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
            str = "Dave"        
        End Sub

        Protected Sub Button2_Click(sender As Object, e As System.EventArgs) Handles Button2.Click    
           Label1.Text = str
        End Sub
    End Class
  • 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-03T13:39:38+00:00Added an answer on June 3, 2026 at 1:39 pm

    Welcome to the world of stateless programming; variables don’t survive after a page is rendered; you need to use the Session object to save them.

    In your button click, set Session(“PersonName”) = “Dave”

    In Page_Load, have code such as:

    str = Session(“PersonName”).ToString()

    I would highly recommend working through a few tutorials in ASP.NET programming to familarize yourself with all the concepts you need.

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

Sidebar

Related Questions

Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Beginner help needed :) I am doign an example form a php book which
Over the last year I have moved from a beginner PHP developer to a
I am a beginner android developer and I am trying to have a button
I am a beginner web developer and i have a site JammuLinks.com , it
I am a beginner Ruby on Rails developer. So far I have created several
So I am a beginner developer. And simply just want to have a UITabBarController.
I am an iPhone developer and a beginner in Titanium Studio. I have some
Sorry for my English - I am from Russia. I am a beginner Ruby
I am a beginner developer with xml and .net. I have series of checkboxlists

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.