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

Empty Footer

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike_T
Top achievements
Rank 1
Mike_T asked on 26 Jan 2012, 10:10 AM
Hello,
I'm using the following code to access the footer SUM of 2 columns, i'm getting a problem when the Grid is empty so there are no footer to display
Private Sub DataGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles DataGrid.ItemDataBound
        If TypeOf e.Item Is GridFooterItem Then
            Dim footerItem As GridFooterItem = DirectCast(e.Item, GridFooterItem)
            
            Dim strUSD As Decimal = footerItem("BalanceUSD").Text
            Dim strLBP As Decimal = footerItem("BalanceLBP").Text
            Dim LBPvalue As Decimal = strLBP * 1507.5
            Dim totalvalue As Decimal = strUSD + LBPvalue
            'MsgBox(totalvalue)
        End If
    End Sub

How do i handle when no data is in the grid?

Regards,
Mike

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Richard
Top achievements
Rank 1
answered on 30 Jan 2012, 03:18 PM
Mike:

One possible approach:

You could get the row count from the pager item and verify that it's greater than "0", and conditionally apply your code.

See the "Getting the total row count" at the bottom of the PAGER ITEM documentation page for insights.

Hope this helps.
Tags
Grid
Asked by
Mike_T
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or