Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
440
ASP.NET Ajax client-side framework failed to load.
posted

Hello,

I am creating and configuring a WebDataGrid dynamically on my page. It works fine, however when I add any behaviours to the grid to allow the user to sort/filter etc, as soon as you try to use any of these features I get the error message "Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.".

My code to create the grid is as follows:

Private Sub BuildDataGrid()
    Dim DataGrid As New Infragistics.Web.UI.GridControls.WebDataGrid

    If p_DashboardObject.SummaryData.SummaryDataTable Is Nothing Then
      p_DashboardObject.ReBuildSummaryData()
    End If

    Dim DataTable As System.Data.DataTable = p_DashboardObject.SummaryData.SummaryDataTable

    If DataTable Is Nothing Then
      Dim Literal As New Literal
      Literal.Text = "No data available"
      Me.Controls.Add(Literal)
    End If

    DataGrid.Height = Unit.Percentage(100)
    DataGrid.Width = Unit.Percentage(100)

    DataGrid.AutoGenerateColumns = False
    DataGrid.DataSource = DataTable

    Dim DataColumn As System.Data.DataColumn
    Dim FormatString As String
    For Each DataColumn In DataTable.Columns
      If Not DataColumn.ColumnName Like "*" & Chr(1) & "*" Then
        Dim BoundField As New Infragistics.Web.UI.GridControls.BoundDataField(True)
        BoundField.DataFieldName = DataColumn.ColumnName
        BoundField.Key = DataColumn.ColumnName
        BoundField.Header.Text = p_DashboardObject.ColumnHeading(DataColumn.ColumnName)
        FormatString = p_DashboardObject.ColumnFormat(DataColumn.ColumnName)
        If FormatString <> "" Then
          If p_DashboardObject.NumericColumn(DataColumn.ColumnName) Then
            BoundField.DataFormatString = p_DashboardObject.PrimaryYAxis.numericPrefix & "{0:N" & p_DashboardObject.PrimaryYAxis.numberDecimals.ToString & "}"
          Else
            BoundField.DataFormatString = FormatString
          End If
        End If
        DataGrid.Columns.Add(BoundField)

        If p_DashboardObject.NumericColumn(DataColumn.ColumnName) Then
          DataGrid.Columns.Item(DataColumn.ColumnName).CssClass = "customRightDataAlign"
          DataGrid.Columns.Item(DataColumn.ColumnName).Header.CssClass = "customGridHeaderRight"
        Else
          DataGrid.Columns.Item(DataColumn.ColumnName).CssClass = "customLeftDataAlign"
          DataGrid.Columns.Item(DataColumn.ColumnName).Header.CssClass = "customGridHeaderLeft"
        End If
      End If
    Next

    If DataGrid.Behaviors.ColumnMoving Is Nothing Then
      DataGrid.Behaviors.Add(DataGrid.Behaviors.CreateBehavior(Of ColumnMoving))
    End If
    DataGrid.Behaviors.ColumnMoving.Enabled = True

    If DataGrid.Behaviors.ColumnResizing Is Nothing Then
      DataGrid.Behaviors.Add(DataGrid.Behaviors.CreateBehavior(Of ColumnResizing))
    End If
    DataGrid.Behaviors.ColumnResizing.Enabled = True

    If DataGrid.Behaviors.Filtering Is Nothing Then
      DataGrid.Behaviors.Add(DataGrid.Behaviors.CreateBehavior(Of Filtering))
    End If
    DataGrid.Behaviors.Filtering.Enabled = True

    If DataGrid.Behaviors.Sorting Is Nothing Then
      DataGrid.Behaviors.Add(DataGrid.Behaviors.CreateBehavior(Of Sorting))
    End If
    DataGrid.Behaviors.Sorting.Enabled = True

    DataGrid.ClientEvents.Initialize = "dg_Initialize"
    DataGrid.DataBind()

    Me.Controls.Add(DataGrid)
  End Sub

Thanks for the help
Nick