This is a migrated thread and some comments may be shown as answers.

Why can't I databind with a column using aggregate

1 Answer 22 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
William asked on 19 Oct 2018, 07:39 PM

Everything works fine, but as soon as I try to use Aggregate and FooterAggregateFormatString, it comes up with a target invocation exception on my databind line.  Am I supposed to do it a different way?

My aspx file has:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1" UpdateInitiatorPanelsOnly="true">
            <telerik:AjaxSetting AjaxControlID="myRadGrid">
                    <telerik:AjaxUpdatedControl ControlID="myRadGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
    <telerik:RadGrid ClientSettings-Scrolling-ScrollHeight="500" ShowFooter="true" ClientSettings-Scrolling-AllowScroll="true" ClientSettings-Scrolling-UseStaticHeaders="true" RenderMode="Lightweight" OnSortCommand="SortCommand" AllowSorting="true" ID="myRadGrid" runat="server"  EnableEmbeddedSkins="False">
        <ItemStyle BackColor="#E2E4FF" Font-Size="10" />
        <AlternatingItemStyle Font-Size="10" />
        <HeaderStyle CssClass="CustomHeader" BorderStyle="Solid" BorderWidth="1" BorderColor="Black" HorizontalAlign="Center" Font-Size="12" />
        <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed">
                <telerik:GridTemplateColumn SortExpression="load_seconds" Aggregate="Sum" FooterAggregateFormatString="Total Seconds: {0}" HeaderButtonType="TextButton" HeaderStyle-Width="14%" HeaderText="Load Seconds">
                        <%#String.Format("{0}", Eval("load_seconds")) %>
                <EditColumn CancelImageUrl="Cancel.gif" InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif">
        <HeaderStyle CssClass="CustomHeader"></HeaderStyle>
        <FilterMenu RenderMode="Lightweight"></FilterMenu>
        <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>

and my aspx.vb files has:

Protected Sub loadData()
        lbl_errormsg.Text = ""
        Dim bEffDt As Date
        Dim eEffDt As Date
        Dim begEffDt As String = ""
        Dim endEffDt As String = ""
        bEffDt = Beg_Date.SelectedDate
        eEffDt = End_Date.SelectedDate
        begEffDt = bEffDt.ToString("yyyy/MM/dd")
        endEffDt = eEffDt.ToString("yyyy/MM/dd")
            myRadGrid.DataSource = FastSQL.SelectQuery("myDB", "my select statement")
        Catch ex As Exception
            lbl_errormsg.Text = "There was an error."
        End Try
    End Sub

with Page_load calling loadData()

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 24 Oct 2018, 02:32 AM
Hello William,

To resolve this issue, you can switch to declarative binding or NeedDataSource binding as suggested in the following article:

In addition, you can also check:

I hope this will prove helpful.

Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question