Search This Blog

17 June 2011

AutoPostBack Property


Autopostback is the mechanism, by which the page w
ill 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.

For Example



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.


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.

2 comments:

  1. visit..
    prateekamitian.blogspot

    thank you

    ReplyDelete
  2. ma'am how can i connect database of some other site bcoz its showing this type of error "Cannot open database "smartlko" requested by the login"

    ReplyDelete