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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:01:52+00:00 2026-05-13T20:01:52+00:00

Suppose an ASP.NET .NET 3.5 Site. There is an asp:TextBox defined with this jquery

  • 0

Suppose an ASP.NET .NET 3.5 Site.

There is an asp:TextBox defined with this jquery javascript attached to it:

$("#myTextBox").change(function() {});

which means that if the user changes the text value, this function will be called.
And of course it works.

The problem is that I’ve made a button in which’s EventHandler it automatically fills this TextBox with the default value. A round trip / page reload occurs and a new value is correctly set. With the difference, that the jquery function change() is not called;

And i need to call that function because it sets a variable to decide whether the text has been changed.

EDITED:

The variable is set to check if the user provided some input. If that’s the case, it offers him the possibility to save it.

The problem isn’t that the variable is not set, when someone clicks on the Button (which makes a value auto-fill), the problem is that the Button causes the page to be reloaded and the var value is lost. And i need to keep the value until the user tries to leave the page.

REFLECTION

Perhaps I could set cookies across the page reloads …

  • 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-13T20:01:53+00:00Added an answer on May 13, 2026 at 8:01 pm

    Seems like you should be setting this other variable, the one that indicates whether the value has changed or not, from the code-behind when the value changes. In other words, it looks like you need to do this in two places.

    Alternatively, you could change the button to set the value via javascript, and set it’s OnClientClick handler instead of it’s OnClick handler. Make sure the end of the OnClientClick returns false, to avoid the postback. In that case, you’d be able to avoid the postback altogether, and your problem would be solved.

    <asp:Button runat="server" ID="someId" OnClientClick="$('#myTextBox').val('someValue');return false;"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a site at www.example.com which has an IFRAME pointing to ASP.NET
How do I handle autopoatback in ASP.NET MVC? Suppose I have a textbox. I
Suppose I have a very large site like amazon.com. I’d like to use asp.net
I have an ASP.NET 3.5 web site project. In it there exists a page
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
Suppose you have two seperate ASP.NET Web Application projects that both need to use
Suppose I have an action that returns an rendered asp.net mvc control and send
I am implementing a file sharing system in ASP.NET MVC3. I suppose most file
VBScript on ASP Classic contains an int function. (It rounds numbers towards -∞.) Suppose
I'm trying to get Twitter authentication working on my ASP.NET site. When you create

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.