This is a migrated thread and some comments may be shown as answers.

RadGrid client-side Group Detection

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel R
Top achievements
Rank 1
Joel R asked on 01 Feb 2009, 05:59 PM

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>

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 02 Feb 2009, 06:30 AM
Hi Joel,

Try with the following approach and see whether it helps.

ASPX:
 <asp:LinkButton ID="lbExpandCollapse" runat="server" CommandName="ExpandCollapseAll"  visible='<%#RadGrid1.MasterTableView.GroupByExpressions.Count>0?true:false %>' > 
    <img  alt=""  src="" > 
    </asp:LinkButton> 


Thanks
Shinu
0
Joel R
Top achievements
Rank 1
answered on 02 Feb 2009, 02:24 PM
works perfect... THANKS
Tags
Grid
Asked by
Joel R
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Joel R
Top achievements
Rank 1
Share this question
or