Please help me understand AutoPostBack property of an ASP.NET control

前端 未结 6 1680
时光取名叫无心
时光取名叫无心 2021-01-21 00:16

I\'m learning about ASP.NET, mainly by following through a book, but also making an effort to actually do things along the way. But, I came across an explanation about list cont

6条回答
  •  不知归路
    2021-01-21 00:32

    • Basically AutoPostBack is used so that whenever there is some change in the controls text or anyother change in the controls property, the page is submitted to the server.
    • Posting the page means, the page is submitted to the server. Suppose i use a textbox and i make its AutoPostBack = "true", now i write some text into it and click outside the textbox, then the page will refresh.
    • This refresh indicates that your value which you entered into the textbox has been submitted to the server.
    • The postback is handled by ASP.NET server. AutoPostBack will automatically post back your page to the server.
    • Add an event Handler. This will give you a better picture. In your case of DropDownList: Add an eventhandler: double click the DropDownList, it will route you to an eventhandler:
    • Write something in that event handler let us say : Response.Write("message");
    • The page will refresh and you will see your message, this means the page was posted to the server and the server has executed your event handler and displayed you the message.

    I hope this was usefull

提交回复
热议问题