I am having an issue hiding a label in a GridTemplateColumn.
Here is my grid:
Here is my code:
Any help appreciated.
Here is my grid:
<
telerik:RadGrid
ID
=
"rgd_User_List"
runat
=
"server"
AllowSorting
=
"True"
DataSourceID
=
"sds_User_Lookup"
GridLines
=
"None"
AllowPaging
=
"True"
PageSize
=
"200"
>
<
ClientSettings
AllowColumnsReorder
=
"True"
ReorderColumnsOnClient
=
"True"
>
</
ClientSettings
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
AlwaysVisible
=
"true"
HorizontalAlign
=
"Center"
Position
=
"TopAndBottom"
>
</
PagerStyle
>
<
MasterTableView
AutoGenerateColumns
=
"False"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"IDStaff"
DataSourceID
=
"sds_User_Lookup"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
ShowAddNewRecordButton
=
"False"
ShowExportToCsvButton
=
"True"
ShowRefreshButton
=
"False"
/>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumn
DefaultInsertValue
=
""
HeaderText
=
" "
UniqueName
=
"TemplateColumn1"
>
<
itemtemplate
>
<%# Container.ItemIndex+1 %>
</
itemtemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"LastName"
HeaderText
=
"Last Name"
SortExpression
=
"LastName"
UniqueName
=
"LastName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FirstName"
HeaderText
=
"First Name"
SortExpression
=
"FirstName"
UniqueName
=
"FirstName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"IDStaff"
HeaderText
=
"Staff ID"
SortExpression
=
"IDStaff"
UniqueName
=
"IDStaff"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"IDBitech"
HeaderText
=
"BiTech ID"
SortExpression
=
"IDBitech"
UniqueName
=
"IDBitech"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"UserName"
HeaderText
=
"User Name"
SortExpression
=
"UserName"
UniqueName
=
"UserName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Password"
HeaderText
=
"Password"
SortExpression
=
"Password"
UniqueName
=
"Password"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"JobTitle"
HeaderText
=
"Job Title"
SortExpression
=
"JobTitle"
UniqueName
=
"JobTitle"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PhoneIP"
HeaderText
=
"IP Phone"
SortExpression
=
"PhoneIP"
UniqueName
=
"PhoneIP"
>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Restraints"
HeaderText
=
"Restraints"
SortExpression
=
"Restraints"
UniqueName
=
"Restraints"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"RestraintsLabel"
runat
=
"server"
Text='<%# Eval("Restraints") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridHyperLinkColumn
DataNavigateUrlFields
=
"UserName"
DataNavigateUrlFormatString
=
"user_details.aspx?UserName={0}"
Text
=
"Details"
UniqueName
=
"UserName"
>
<
ItemStyle
CssClass
=
"radgrid"
/>
</
telerik:GridHyperLinkColumn
>
<
telerik:GridHyperLinkColumn
AllowFiltering
=
"False"
DataNavigateUrlFields
=
"EmailAddress"
DataNavigateUrlFormatString
=
"mailto:{0}"
HeaderText
=
" "
ItemStyle-HorizontalAlign
=
"Center"
UniqueName
=
"EmailAddress"
>
<
ItemStyle
CssClass
=
"radgrid"
Width
=
"50px"
/>
</
telerik:GridHyperLinkColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Protected
Sub
rgd_User_List_ItemDataBound(sender
As
Object
, e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
rgd_User_List.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
Then
Dim
item
As
GridDataItem =
DirectCast
(e.Item, GridDataItem)
Dim
value
As
String
= item(
"Restraints"
).Text
If
value =
"1"
Then
Dim
Restraints
As
Label =
DirectCast
(item(
"RestraintsLabel"
).Controls(0), Label)
Restraints.Visible =
False
End
If
End
If
End
Sub
Any help appreciated.