R
ruca
Hi,
I want to set visible to false in my datagrid to all fields that are an ID.
How can I do this?
I'm using ItemDataBound event but it gives me an error: "Index was out of
range. Must be non-negative and less than the size of the collection.
Parameter name: index"
I have this code:
---------------------------------------------------------------------------------------------
Sub Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
Try
Dim i As Integer = 0
Dim lCol As Integer = dg.Columns.Count()
Dim strH As String
For i = 0 To lCol
strH = dg.Columns(i).HeaderText().ToUpper()
If Left(strH, 2) = "Id" Then
dg.Columns(i).Visible = False
End If
Next
Catch ex As Exception
lblMsgErro.Text = ex.Message()
End Try
I want to set visible to false in my datagrid to all fields that are an ID.
How can I do this?
I'm using ItemDataBound event but it gives me an error: "Index was out of
range. Must be non-negative and less than the size of the collection.
Parameter name: index"
I have this code:
---------------------------------------------------------------------------------------------
Sub Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
Try
Dim i As Integer = 0
Dim lCol As Integer = dg.Columns.Count()
Dim strH As String
For i = 0 To lCol
strH = dg.Columns(i).HeaderText().ToUpper()
If Left(strH, 2) = "Id" Then
dg.Columns(i).Visible = False
End If
Next
Catch ex As Exception
lblMsgErro.Text = ex.Message()
End Try