Hi, I have a template column titled 'FileID' and am trying to access it. Unfortunately whenever it comes across a template column, it will error out saying that FileID is not a column.
ASPX:
From this you can see that my GridTemplateColumn's DataField is named "FileID"
VB.NET:
And this is what throws the error: dg.MasterTableView.GetColumn(col.DataField).Display = True underneath the TemplateColumn part.
Did I not name the column correctly? I thought DataField was what I used, and it works on the rest of the BoundColumns. Can I get some pointers here?
Thanks!
ASPX:
<
telerik:GridTemplateColumn
DataField
=
"FileID"
HeaderText
=
"File / Link"
HeaderStyle-Width
=
"55px"
SortExpression
=
"FileID"
HeaderStyle-ForeColor
=
"White"
AllowFiltering
=
"false"
ItemStyle-Width
=
"20%"
ItemStyle-Wrap
=
"true"
ShowSortIcon
=
"false"
>
<
ItemTemplate
>
<
asp:HyperLink
ID
=
"hlLink"
runat
=
"server"
Target
=
"_blank"
Visible
=
"false"
></
asp:HyperLink
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
From this you can see that my GridTemplateColumn's DataField is named "FileID"
VB.NET:
For
Each
col
In
dg.Columns
If
(col.
GetType
()
Is
GetType
(Telerik.Web.UI.GridBoundColumn))
Then
If
col.HeaderText = ColumnName
Then
If
HideOrShow
Then
dg.MasterTableView.GetColumn(col.DataField).Display =
True
Else
dg.MasterTableView.GetColumn(col.DataField).Display =
False
End
If
End
If
Else
If
(col.
GetType
()
Is
GetType
(Telerik.Web.UI.GridTemplateColumn))
Then
If
HideOrShow
Then
dg.MasterTableView.GetColumn(col.DataField).Display =
True
Else
dg.MasterTableView.GetColumn(col.DataField).Display =
False
End
If
End
If
End
If
Next
And this is what throws the error: dg.MasterTableView.GetColumn(col.DataField).Display = True underneath the TemplateColumn part.
Did I not name the column correctly? I thought DataField was what I used, and it works on the rest of the BoundColumns. Can I get some pointers here?
Thanks!