how to restrict firing itemdatabound twice in

2 posts, 0 answers
  1. Loki
    Loki avatar
    4 posts
    Member since:
    May 2015

    Posted 18 Mar 2016 Link to this post

    Hi Telerik team,

    i strucked in getting result in rad grid footer. bcoz itemdatabound firing twice in, result is getting doubled.


    Dim total As Integer
        Protected Sub grdAddList_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdAddList.ItemDataBound

                If TypeOf e.Item Is GridDataItem Then
                    Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
                    Dim fieldValue As Integer = Integer.Parse(dataItem("Amount").Text)
                    total = (total + fieldValue)
                End If

                If TypeOf e.Item Is GridFooterItem Then
                    Dim footerItem As GridFooterItem = CType(e.Item, GridFooterItem)
                    footerItem("Amount").Text = "Total: " + total.ToString()
                End If

            Catch ex As Exception
                Dim strExpMsg As String
                strExpMsg = className & "." & MethodBase.GetCurrentMethod().Name & "()" & "->" & ex.Message.ToString()
                ExceptionHandler(strExpMsg, ex, Me.strUserName)
            End Try
        End Sub





  2. Viktor Tachev
    Viktor Tachev avatar
    2501 posts

    Posted 22 Mar 2016 Link to this post

    Hello Lokesh,

    I have replied to your query in the other thread you have submitted and suggest we continue the conversation there. Please check out the following link:

    With that said, for calculating totals and displaying the result in the grid footer you should use the approach described in the following thread:

    Viktor Tachev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top