AutoPostBack property - TextBox

M

mg

A WebControl TextBox posts back to the server whether or not the AutoPostBack
property is true, when the TextBox looses focus following a text change. So,
what's the purpose of this property?
 
K

Ken Cox [Microsoft MVP]

What you say is only partially true. When you use Autopostback, there's a
postback not only when you press Enter in the testbox, but also onblur such
as when you tab out of the textbox. Try the following code with autopostback
true and then false and ttab in and out of the textbox. You'll see the
difference.

<%@ Page Language="VB" %>
<script runat="server">

sub page_load
if ispostback then
label1.text=now.tolongtimestring()
end if
end sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Label id="Label1" runat="server">Label</asp:Label>
</p>
<p>
<asp:TextBox id="TextBox1" runat="server"
AutoPostBack="True"></asp:TextBox>
</p>
<!-- Insert content here -->
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top