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

how to restrict firing itemdatabound twice in vb.net

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Loki
Top achievements
Rank 1
Loki asked on 18 Mar 2016, 12:22 PM

Hi Telerik team,

i strucked in getting result in rad grid footer. bcoz itemdatabound firing twice in vb.net, 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
        Try

            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

 

Thanks,

Lokesh

 

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 22 Mar 2016, 07:30 AM
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:



Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Loki
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or