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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:59:17+00:00 2026-06-18T03:59:17+00:00

I have a TextBox and a postback Button. <asp:TextBox ID=TextBox1 runat=server OnTextChanged=TextBox1_TextChanged1 EnableViewState=false></asp:TextBox><span></span> <asp:Button

  • 0

I have a TextBox and a postback Button.

<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged1"     EnableViewState="false"></asp:TextBox><span></span>
<asp:Button ID="Button1" runat="server" Text="Button" />

So, I need to fire TextChanged event only when text changed(what an irony), like it fires when EnableViewState is true. I can’t unsubscribe event or subscribe it somwhere else or enable ViewState.
I’ve tried to save text from the TextBox in HiddenField and then check if it’s changed. Here’s the code

 protected void Page_Load(object sender, EventArgs e) {
    if (HiddenField1.Value != TextBox1.Text) {
        HiddenField1.Value = TextBox1.Text;
        TextBox1.Text = HiddenField1.Value;
    }           
}

But I have no idea what to do when text is not changed and not to fire the event.

  • 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-18T03:59:18+00:00Added an answer on June 18, 2026 at 3:59 am

    The problem was in saving values from TextBox when ViewState disabled. Saving it in HiddenField is not a good idea, because we can take value from HiddenField on Page_Load, but we need to take it on TextBox init. However, if we save TextBox to Session variable, this problem will disappear. Here’s the code:

    protected void TextBox1_TextChanged1(object sender, EventArgs e) {
        Session["text"] = TextBox1.Text;
    }
    protected void TextBox1_Init(object sender, EventArgs e) {
        if(Session["text"]!=null)TextBox1.Text = Session["text"].ToString();
    }
    

    Save values in session variable on textchanged event and restore it on textbox init. Comparison run on framework level.

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

Sidebar

Related Questions

On a page I have: <asp:TextBox runat=server ID=EmailTextBox AutoPostBack=true OnTextChanged=EmailTextBox_Changed /> <asp:Button runat=server ID=SearchButton
I have an asp.net button to update database <asp:Button ID=btnSave runat=server Text=SaveChanges OnClick=btnSave_Click CssClass=saveButton
I have for example ASP.NET site with textbox, button and many other controls. When
I have an asp:Wizard in my Webforms application: <WizardSteps> <asp:WizardStep ID=WizardStep1 runat=server StepType=Start Title=a>
I have Textbox with blue Background and white Foreground . When entering a text
I have a text box in a page. Whose visibility is set false from
I have created a asp:TextBox. its disabled. but its values is changed via javascript.
What I have is button that should open another page only if textbox length
I have a TextBox inside an asp.net UpdatePanel that records the number of key
<ajaxToolkit:ModalPopupExtender runat=server id=ModalPopupExtender1 cancelcontrolid=btnCancel okcontrolid=btnOkay targetcontrolid=Button1 popupcontrolid=Panel1 drag=true backgroundcssclass=ModalPopupBG /> <asp:Button ID=Button1 runat=server Text=Test

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.