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

前端 未结 6 1671
时光取名叫无心
时光取名叫无心 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:29

    For normal client controls (such as a list control with AutoPostBack set to false), when a user chooses an item in the list, the browser does not communicate with the server. There's no network traffic and no delay for your user before they see the results of the choice, but there's also no opportunity to do anything in your server code, like calculate dependent values. If you want to do anything to the screen in response to the choice, you have to use a client-side script.

    When AutoPostBack is set to true, selecting an item in the list sends a message to the server (via an HTTP POST). ASP.NET then executes whatever code you have attached to the list's changed event, rebuilds the page, and sends the revised page to the client.

提交回复
热议问题