/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu

Thursday, September 22, 2011

AutoPostBack Property in asp.net

AutoPostBack Property

What ? Autopostback is the mechanism, by which the page will be posted ,back to the server automatically based on some events in the web controls. In some of the web controls, the property called auto post back, which if set to true, will send the request to the server when an event happens in the control. If this property is set to TRUE the automatic post back is enabled, otherwise FALSE. "Default value of AutoPostBack property is FALSE."


Why  ? we need to set autopostback=true of controls?

Consider a scenario where the web page is used for entering the user information. The page contains two dropdownlist controls ddlcountry and ddlstate. When user selects the country, the appropriate states be filled in the ddlstate which is loaded from the database. For achieving this requirement, we can set the autopostback property of ddlcountry to true. If we do that we can handle the event in the server side and write code to populate the ddlstate with the values from the database.
This is how we use the autopostback property. 


Note* By default the button,linkbutton and imagebutton has an autopostback as an event. The code behind that you write is to handle this postback. A button cannot have an explicit button postback but is in-built.

No comments:

Post a Comment

My Blog List

  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी संतान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    3 months ago
  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी शमशान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    3 months ago
  • Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)
    10 years ago