A
Antonio
Hi,
I have been spending two full days to get this problem resolved but failed.
After successfully finding the label control, the Label.Text is always
having an empty string. But when the DataGrid finish rendered, all the
values are there, why??? Please refer to my code below:
Private Sub DataGrid_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
Dim lblCell As Label = CType(e.Item.Cells(2).FindControl("lblJan"), Label)
If CDbl(lblCell.Text.Trim) > 0 Then
lblCell.Text = ""
End If
End Select
End Sub
During the conversion to double, it get error because the text property is
having an empty string. But in actual fact, the final output to the cell is
6000. Why?? I just can't get the value populated! Can somebody help me pls?
Thanks!
Antonio
'For i = intJan To intDec
' intMth += 1
' Dim lblCell As New Label
' lblCell = CType(e.Item.Cells(i).FindControl("lbl" & MonthName(intMth,
True)), Label)
' If IsNumeric(lblCell.Text.Trim) Then
' lblCell.Text = Format(CDbl(lblCell.Text), "###,###,###,##0.00")
' If lblCell.Text.Trim = "-1.00" Then
' lblCell.Text = ""
' End If
' End If
'Next
End Select
End Sub
I have been spending two full days to get this problem resolved but failed.
After successfully finding the label control, the Label.Text is always
having an empty string. But when the DataGrid finish rendered, all the
values are there, why??? Please refer to my code below:
Private Sub DataGrid_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
Dim lblCell As Label = CType(e.Item.Cells(2).FindControl("lblJan"), Label)
If CDbl(lblCell.Text.Trim) > 0 Then
lblCell.Text = ""
End If
End Select
End Sub
During the conversion to double, it get error because the text property is
having an empty string. But in actual fact, the final output to the cell is
6000. Why?? I just can't get the value populated! Can somebody help me pls?
Thanks!
Antonio
'For i = intJan To intDec
' intMth += 1
' Dim lblCell As New Label
' lblCell = CType(e.Item.Cells(i).FindControl("lbl" & MonthName(intMth,
True)), Label)
' If IsNumeric(lblCell.Text.Trim) Then
' lblCell.Text = Format(CDbl(lblCell.Text), "###,###,###,##0.00")
' If lblCell.Text.Trim = "-1.00" Then
' lblCell.Text = ""
' End If
' End If
'Next
End Select
End Sub