I'm having trouble wrapping my head around how to implement something that I previously accomplished with a standard .Net DataGrid. I've created a RadGrid control with a Master/Details table structure. The detail columns include: ID, title, bReady, and bCompleted. I want to programmatically check if bReady=false and if so set a hyperlink column to not be visible. There are also some other pieces of logic I'd like to implement.
I tried using ItemDataBound of the Grid and OnDataBinding on the DetailsTable GridView, but nothing I've tried is working.
| <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="lpu" |
| GridLines="None" Width="576px"> |
| <MasterTableView DataKeyNames="uid" DataSourceID="lpu" HierarchyLoadMode="ServerBind"> |
| <DetailTables> |
| <telerik:GridTableView DataKeyNames="esi" |
| DataSourceID="lps" Width="100%" runat="server" CommandItemDisplay="None" |
| HeaderStyle-Height="0"> |
| <ParentTableRelation> |
| <telerik:GridRelationFields DetailKeyField="eui" MasterKeyField="eui" /> |
| </ParentTableRelation> |
| <Columns> |
| <telerik:GridBoundColumn SortExpression="esi" HeaderText="esi" |
| DataField="esi" UniqueName="esi" Visible="false" |
| ReadOnly="true"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn AllowSorting="false" DataField="title" |
| UniqueName="title"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn AllowSorting="false" DataField="bReady" Visible="true" |
| UniqueName="bReady"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn AllowSorting="false" DataField="bCompleted" Visible="false" |
| UniqueName="bCompleted"> |
| </telerik:GridBoundColumn> |
| <telerik:GridHyperLinkColumn DataNavigateUrlFormatString="javascript:launch('launch.aspx?esi={0}');" |
| DataNavigateUrlFields="esi" DataType="Int32" Text="View"> |
| </telerik:GridHyperLinkColumn> |
| </Columns> |
| <HeaderStyle Height="0px"></HeaderStyle> |
| </telerik:GridTableView> |
| </DetailTables> |
| <ExpandCollapseColumn Visible="True"> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="eui" DataType="System.Decimal" HeaderText="eui" |
| ReadOnly="True" SortExpression="eui" UniqueName="eui" |
| Visible="False"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="uo" DataType="System.Int32" HeaderText="uo" |
| SortExpression="uo" UniqueName="uo" Visible="False"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="un" HeaderText="Name" SortExpression="un" |
| UniqueName="un"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
Can someone guide me on what I need to put into the ItemDataBound method to set up this behavior? Here's where I've started but have gotten stuck.
Thanks
| if (e.Item is GridItem) |
| { |
| if (e.Item.OwnerTableView.ParentItem != null) |
| { |
| if (e.Item.OwnerTableView.DetailTables.Count > 0) |
| { |
| foreach (GridTableView dt in e.Item.OwnerTableView.DetailTables ) { |
| foreach (GridDataItem gdi in dt.Items) |
| { |
| } |
| } |
| } |
| } |
| } |