TextBox AutoPostBack and TextChanged Event ASP.Net

TextBox AutoPostBack ASP.Net Example

In this asp.net tutorial we will learn about TextBox control TextChanged events and AutoPostBack property with an example.

TextBox TextChanged event and AutoPostBack in ASP.Net
TextBox TextChanged event and AutoPostBack in ASP.Net

TextBox control is a input control in asp.net, that allow user to input text on web page. Here we will disccuss TextBox TextChanged event in asp.net. The TextBox TextChanged event occurs when text changed in textbox control. The TextChanged event triggers while text changed in textbox.

  • Note : Set TextBox property AutoPostBack = True

TextChanged TextBox ASP.Net Example

Generally we write c# code in button click events, so buttons AutoPostBack property by default set true.
If we write some c# code on TextBox TextChanged event and want to execute the code, we must first set AutoPostBack = True of TextBox control.

Here, In below example we will do sum of two integer using textbox TextChanged event.

Step 1 : Open Visual Studio — > Create Empty Website

Step 2 : Add New WebForm

Step 3 : Design Web form with Two TextBox Control along with one Label control

Step 4  : Set AutoPostBack = True for TextBox2 control

Step 5 : write C# code on TextChange event of TextBox2 control

TextBox AutoPostBack ASP.Net Example

HTML Design code of .aspx page

TextBox TextChanged event and AutoPostBack in ASP.Net
TextBox TextChanged event and AutoPostBack in ASP.Net

C# Code for above TextBox Example

(Visited 36 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *