2
Answers

AutoPostBack Property

Akash Ahlawat

Akash Ahlawat

12y
2.1k
1
Hi Friends,
I want to know about the use of AutoPostBack?
Answers (2)
0
Gohil Jayendrasinh

Gohil Jayendrasinh

NA 6.1k 2.8m 12y

hi

 The AutoPostBack property is used to set or return whether or not an automatic post back occurs when the user presses
"ENTER" or "TAB" in the TextBox control.

If this property is set to TRUE the automatic post back is enabled, otherwise FALSE. Default is FALSE.

Ex.
<script runat="server">
Sub change(sender As Object, e As EventArgs)
lbl1.Text="You changed text to " & txt1.Text
End Sub
</script>


<html>
<body>

<form runat="server">
Enter your name:
<asp:TextBox id="txt1" runat="server"
Text="Hello World!"
OnTextChanged="change" AutoPostBack="true"/>
<p><asp:Label id="lbl1" runat="server" /></p>
</form>

</body>
</html>

if it's helpful to you then please check Accepted Asnwers
Thanks

Accepted
0
Senthilkumar

Senthilkumar

NA 15.2k 2.4m 12y
Hi Akash,

The AutoPostBack is the property in the ASP.Net web server controls, which accepts the boolean(true/false) as value. When certain events happens in the controls which tells the browser whether it has to be posted back to the server or not.

The controls like DropDownList, TextBox will have the AutoPostBack value is false. Which means when event happens like ENTER, TAB, IndexChanged it will not posted back to the server.

Suppose we have the dropdownlist and based on the selection made it has to populate the result in the grid then we need to enable the postback property.

<asp:DropDownList id="ddlEmployees" runat="server" AutoPostBack="true" onIndexChanged="eventname"/>

When we enable the property only it allows to execute the server side event.



Next Recommended Forum