I have a RadGrid that allows the user to use groups. In the commandItemTemplate I want to hide or show an image depending on whether the user has created any groups in the grid or not.
I tried the line in bold but it does not work as I get a parse error as follows:
Cannot create an object of type 'System.Boolean' from its string representation '<%= RadGridList.MasterTableView.GetItems(GridItemType.GroupHeader).Length > 0 ? "true" : "false" %>' for the 'Visible' property.
Any suggestions are appreciated.
<CommandItemTemplate>
<asp:LinkButton ID="LinkButton" runat="server" CommandName="InitInsert" Visible='<%# !RadGridList.MasterTableView.IsItemInserted %>'>
<img src='AddRecord.gif' />
<asp:Label ID="lbl1" runat="server" Text='Add New Record' /></asp:LinkButton>
<asp:LinkButton ID="lbExpandCollapse" runat="server" CommandName="ExpandCollapseAll" Visible='<%= RadGridList.MasterTableView.GetItems(GridItemType.GroupHeader).Length > 0 ? true : false %>
'>
<img src="ExpandCollapse.jpg">
</asp:LinkButton>
</CommandItemTemplate>