AxpDataGrid

Server side coding

Set properties on every Page request

When properties are set in Server side code, it is important to set all properties on every Page request.

AxpDataGrid does not utilize ViewState so using the typical code pattern in the Page Load method where properties for a WebControl is only set on the first page request, using a check on Page.IsPostback should not generally be used for AxpDataGrid.

Do not do this
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  If Not Page.IsPostback Then
    AxpDataGrid1.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
    AxpDataGrid.SQL = "SELECT * From Products"
  End If
End Sub
Do this
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  AxpDataGrid1.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
  AxpDataGrid.SQL = "SELECT * From Products"
End Sub

Note AxpDataGrid properties inherited from WebControl are persisted in ViewState. This includes Enabled and Visible so do take some care if manipulating those properties.

Remarks

See Also

AxpDataGrid Tutorial