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

Enable/Disable all edit and delete button if any levels items is being editted in Hierarchical Grid

3 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Binod
Top achievements
Rank 1
Binod asked on 05 Apr 2010, 02:51 PM
Hi Telerik

I am using four levels Hierarchical grid. here i need to disabled all the level's grid edit and delete button if a item is being editted in any level. i mean if 4th level grid data is in edit mode then the edit/delete button in 1st,2nd and 3rd level grid should be disabled. i tried it but i am able to find grid EditItem itself in ItemDataBound. Below is my Code in aspx page.
 <telerik:RadGrid ID="rdGOSTView" runat="server" AllowPaging="true" PageSize="3" AllowSorting="True" 
                    OnDetailTableDataBind="rdGOSTView_DetailTableDataBind" OnNeedDataSource="rdGOSTView_NeedDataSource" 
                    OnPreRender="rdGOSTView_PreRender" OnDeleteCommand="rdGOSTView_DeleteCommand" 
                    OnInsertCommand="rdGOSTView_InsertCommand" OnItemCreated="rdGOSTView_ItemCreated" 
                    OnItemDataBound="rdGOSTView_ItemDataBound" OnUpdateCommand="rdGOSTView_UpdateCommand" 
                    OnItemCommand="rdGOSTView_ItemCommand">  
                    <GroupingSettings CaseSensitive="false" /> 
                    <FilterItemStyle HorizontalAlign="Left" /> 
                    <HeaderStyle HorizontalAlign="Center" ForeColor="Black" Font-Bold="true" Font-Size="10px" 
                        Font-Names="Verdana" /> 
                    <AlternatingItemStyle Font-Size="10px" Font-Names="verdana" /> 
                    <ItemStyle HorizontalAlign="Left" Font-Size="10px" Font-Names="verdana" /> 
                    <PagerStyle Mode="NumericPages"></PagerStyle> 
                   <GroupHeaderItemStyle HorizontalAlign="Left" Width="15px" VerticalAlign="Middle" /> 
                   <GroupingSettings ExpandTooltip="Expand" CollapseTooltip="Collapse"/>  
                    <MasterTableView DataKeyNames="GoalID" Width="100%" CommandItemDisplay="Top" Name="Goals" 
                        EditMode="EditForms" AutoGenerateColumns="false" TableLayout="Fixed" HierarchyLoadMode="ServerBind">  
                        <%--Goal Grid Starts--%> 
                        <DetailTables> 
                            <%--Objective Grid Starts--%> 
                            <telerik:GridTableView DataKeyNames="GoalID,ObjectiveID" Width="100%" runat="server" 
                                AutoGenerateColumns="false" CommandItemDisplay="Top" Name="Objectives" EditMode="EditForms">  
                                <ParentTableRelation> 
                                    <telerik:GridRelationFields DetailKeyField="GoalID" MasterKeyField="GoalID" /> 
                                </ParentTableRelation> 
                                <DetailTables> 
                                    <%--Strategy Grid Starts--%> 
                                    <telerik:GridTableView DataKeyNames="GoalID,ObjectiveID,StrategyID" Width="100%" 
                                        AutoGenerateColumns="false" runat="server" CommandItemDisplay="Top" Name="Strategy" 
                                        EditMode="EditForms">  
                                        <ParentTableRelation> 
                                            <telerik:GridRelationFields DetailKeyField="ObjectiveID" MasterKeyField="ObjectiveID" /> 
                                        </ParentTableRelation> 
                                        <DetailTables> 
                                            <%--Tactics Grid starts--%> 
                                            <telerik:GridTableView DataKeyNames="GoalID,ObjectiveID,StrategyID,TacticsID" Width="100%" 
                                                AutoGenerateColumns="false" runat="server" CommandItemDisplay="Top" Name="Tactics" 
                                                EditMode="EditForms">  
                                                <ParentTableRelation> 
                                                    <telerik:GridRelationFields DetailKeyField="StrategyID" MasterKeyField="StrategyID" /> 
                                                </ParentTableRelation> 
                                                <Columns> 
                                                    <%--Tactics Grid Column--%> 
                                                    <telerik:GridBoundColumn DataField="GoalID" UniqueName="GoalID" HeaderText="GoalID" 
                                                        Visible="false">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="ObjectiveID" UniqueName="ObjectiveID" HeaderText="ObjectiveID" 
                                                        Visible="false">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="StrategyID" UniqueName="StrategyID" HeaderText="StrategyID" 
                                                        Visible="false">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="TacticsID" UniqueName="TacticsID" HeaderText="TacticsID" 
                                                        Visible="false">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="PriorityOrder" UniqueName="PriorityOrder" HeaderText="#" 
                                                        Visible="true" ItemStyle-Width="20px" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" 
                                                        FilterControlWidth="20px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridTemplateColumn HeaderText="Tactics" Visible="true" UniqueName="Tactics" 
                                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">  
                                                        <ItemTemplate> 
                                                            <asp:Label ID="lblTac" runat="server" Text='<%#Bind("Tactics")%>'></asp:Label> 
                                                        </ItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridBoundColumn DataField="PointPersonName" UniqueName="PointPerson" HeaderText="Point Person" 
                                                        Visible="true" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center" 
                                                        CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ItemStyle-Wrap="true">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="TimeFrame" UniqueName="TimeFrame" HeaderText="Time Frame" 
                                                        Visible="true" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridBoundColumn DataField="OtherPointPerson" UniqueName="OtherPointPerson" 
                                                        HeaderText="OtherPointPerson" Visible="false">  
                                                    </telerik:GridBoundColumn> 
                                                    <telerik:GridTemplateColumn UniqueName="PriorityStatus" HeaderText="Status" DataField="StatusID" 
                                                        ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="30px" 
                                                        Visible="true" AllowFiltering="false">  
                                                        <ItemTemplate> 
                                                            <asp:ImageButton ID="btnStatus" runat="server" ImageUrl='<%#Bind("logopath")%>' ToolTip='<%#Bind("Status")%>' /> 
                                                        </ItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="EditCommandColumn" HeaderStyle-HorizontalAlign="Center" 
                                                        ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                                        <ItemTemplate> 
                                                            &nbsp;<asp:ImageButton ID="btnEdit" ToolTip="Edit" runat="server" ImageUrl="~/images/Edit.gif" 
                                                                CommandName="Edit" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                                        </ItemTemplate> 
                                                        <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                                        <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="DeleteCommandColumn" 
                                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                                        <ItemTemplate> 
                                                            &nbsp;<asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" ImageUrl="~/images/Delete.gif" 
                                                                CommandName="Delete" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                                        </ItemTemplate> 
                                                        <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                                        <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                                    </telerik:GridTemplateColumn> 
                                                </Columns> 
                                                <CommandItemTemplate> 
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">  
                                                        <tr> 
                                                            <td width="40%" align="left" style="padding-left: 10px">  
                                                                <%--   <asp:CheckBox ID="chkViewFilter" runat="server" Checked="false" onclick="showFilterItemGrid2(this)" /> 
                                                        <asp:Label ID="Label4" runat="server" Text=" Show Filter"></asp:Label>--%> 
                                                                <asp:Label ID="lblTactics" runat="server" Text="Tactics"></asp:Label> 
                                                            </td> 
                                                            <td align="right" style="padding-right: 15px">  
                                                            </td> 
                                                            <td align="right" width="60%">  
                                                                <asp:Image ID="Imge" ImageUrl="~/Images/AddRecord.gif" runat="server" /><asp:LinkButton  
                                                                    ID="btn_Add" Font-Size="10px" Text="Add New" Font-Underline="true" runat="server" 
                                                                    CommandName="InitInsert" Enabled="true" ToolTip="Add New Record"></asp:LinkButton> 
                                                            </td> 
                                                        </tr> 
                                                    </table> 
                                                </CommandItemTemplate> 
                                                <EditFormSettings PopUpSettings-Modal="true" PopUpSettings-Width="810px" EditFormType="Template">  
                                                    <FormTemplate> 
                                                        <table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #ffffff;  
                                                            padding-left: 10px" height="100px">  
                                                            <tr> 
                                                                <td class="select_parameter" align="left" style="width: 100px">  
                                                                    Priority Order  
                                                                </td> 
                                                                <td align="left" style="width: 170px">  
                                                                    <telerik:RadComboBox ID="rdcmbTPriorityOrder" runat="server" Width="170px">  
                                                                    </telerik:RadComboBox> 
                                                                </td> 
                                                                <td class="select_parameter" align="left" style="width: 90px">  
                                                                    Tactics  
                                                                </td> 
                                                                <td align="left" style="width: 60%" colspan="7">  
                                                                    <telerik:RadTextBox ID="txtTactics" MaxLength="250" Text='<% #Bind("Tactics") %>' 
                                                                        Width="100%" runat="server" Font-Names="verdana" Font-Size="10px" Wrap="true" 
                                                                        Height="15px">  
                                                                    </telerik:RadTextBox> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td class="select_parameter" align="left">  
                                                                    Point Person  
                                                                </td> 
                                                                <td align="left">  
                                                                    <telerik:RadComboBox ID="rdcmbPointPerson" runat="server" EmptyMessage='Select PointPerson' 
                                                                        Width="170px" Height="220px">  
                                                                        <Items> 
                                                                            <telerik:RadComboBoxItem runat="server" /> 
                                                                        </Items> 
                                                                        <ItemTemplate> 
                                                                            <div> 
                                                                                <telerik:RadTreeView ID="rtPointPerson" runat="server" CheckBoxes="true" OnClientNodeChecked="onPPNodeChecked">  
                                                                                </telerik:RadTreeView> 
                                                                            </div> 
                                                                        </ItemTemplate> 
                                                                    </telerik:RadComboBox> 
                                                                </td> 
                                                                <td class="select_parameter" align="left">  
                                                                    TimeFrame  
                                                                </td> 
                                                                <td colspan="7">  
                                                                    <table> 
                                                                        <tr> 
                                                                            <td> 
                                                                                From  
                                                                            </td> 
                                                                            <td> 
                                                                                <telerik:RadDatePicker Width="100px" DateInput-ReadOnly="true" ID="fromDatePicker" 
                                                                                    runat="server">  
                                                                                    <DatePopupButton Visible="True"></DatePopupButton> 
                                                                                </telerik:RadDatePicker> 
                                                                            </td> 
                                                                            <td> 
                                                                                To  
                                                                            </td> 
                                                                            <td> 
                                                                                <telerik:RadDatePicker Width="100px" DateInput-ReadOnly="true" Visible="true" ID="toDatePicker" 
                                                                                    runat="server">  
                                                                                    <DatePopupButton Visible="True"></DatePopupButton> 
                                                                                </telerik:RadDatePicker> 
                                                                            </td> 
                                                                        </tr> 
                                                                    </table> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td class="select_parameter" align="left">  
                                                                    Additional Point Person  
                                                                </td> 
                                                                <td align="left">  
                                                                    <telerik:RadTextBox ID="rdtxtOthersPointPerson" MaxLength="100" runat="server" Width="170px" 
                                                                        Text='<% #Bind("OtherPointPerson") %>'>  
                                                                    </telerik:RadTextBox> 
                                                                </td> 
                                                                <td class="select_parameter" align="left">  
                                                                    Status  
                                                                </td> 
                                                                <td align="left">  
                                                                    <telerik:RadComboBox ID="rdcmbStatus" runat="server" Width="170px" Height="150px">  
                                                                    </telerik:RadComboBox> 
                                                                </td> 
                                                                <td align="right" colspan="6" style="padding-right: 20px">  
                                                                    <asp:ImageButton ID="imgTUpdate" ToolTip='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' 
                                                                        runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>' 
                                                                        ImageUrl="~/images/Update.gif" OnClientClick="if(!validationTactics())return false;">  
                                                                    </asp:ImageButton> 
                                                                    &nbsp;  
                                                                    <asp:ImageButton ID="imgTCancel" runat="server" CausesValidation="false" CommandName="Cancel" 
                                                                        ToolTip="Cancel" ImageUrl="~/images/Cancel.gif" OnClientClick="if(!CancelValidation())return false;" /> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </FormTemplate> 
                                                </EditFormSettings> 
                                            </telerik:GridTableView> 
                                            <%--Tactics Grid Ends--%> 
                                        </DetailTables> 
                                        <Columns> 
                                            <%--Strategy Grid Column--%> 
                                            <telerik:GridBoundColumn DataField="GoalID" UniqueName="GoalID" HeaderText="GoalID" 
                                                Visible="false">  
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridBoundColumn DataField="ObjectiveID" UniqueName="ObjectiveID" HeaderText="ObjectiveID" 
                                                Visible="false">  
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridBoundColumn DataField="StrategyID" UniqueName="StrategyID" HeaderText="StrategyID" 
                                                Visible="false">  
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridBoundColumn DataField="PriorityOrder" UniqueName="PriorityOrder" HeaderText="#" 
                                                Visible="true" ItemStyle-Width="30px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">  
                                            </telerik:GridBoundColumn> 
                                            <telerik:GridTemplateColumn HeaderText="Strategy" Visible="true" UniqueName="Strategy" 
                                                ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">  
                                                <ItemTemplate> 
                                                    <asp:Label ID="lblstr" runat="server" Text='<%#Bind("Strategy")%>'></asp:Label> 
                                                    <asp:ImageButton ID="imgbtnChange" ImageUrl='<%#Bind("RDLogoPath")%>' CommandName="RDChange" 
                                                        Enabled="true" CssClass="MyImageButton" runat="server" OnClientClick="if(!CancelChanges())return false;" /> 
                                                </ItemTemplate> 
                                                <ItemStyle Width="80%" HorizontalAlign="Left" /> 
                                                <HeaderStyle Width="80%" HorizontalAlign="Center" /> 
                                            </telerik:GridTemplateColumn> 
                                            <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="EditCommandColumn" HeaderStyle-HorizontalAlign="Center" 
                                                ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                                <ItemTemplate> 
                                                    &nbsp;<asp:ImageButton ID="btnEdit" ToolTip="Edit" runat="server" ImageUrl="~/images/Edit.gif" 
                                                        CommandName="Edit" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                                </ItemTemplate> 
                                                <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                                <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                            </telerik:GridTemplateColumn> 
                                            <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="DeleteCommandColumn" 
                                                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                                <ItemTemplate> 
                                                    &nbsp;<asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" ImageUrl="~/images/Delete.gif" 
                                                        CommandName="Delete" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                                </ItemTemplate> 
                                                <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                                <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                            </telerik:GridTemplateColumn> 
                                        </Columns> 
                                        <CommandItemTemplate> 
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
                                                <tr> 
                                                    <td width="40%" align="left" style="padding-left: 10px">  
                                                        <%--   <asp:CheckBox ID="chkViewFilter" runat="server" Checked="false" onclick="showFilterItemGrid2(this)" /> 
                                                        <asp:Label ID="Label4" runat="server" Text=" Show Filter"></asp:Label>--%> 
                                                        <asp:Label ID="lblStrategy" runat="server" Text="Strategy"></asp:Label> 
                                                    </td> 
                                                    <td align="right" style="padding-right: 15px">  
                                                    </td> 
                                                    <td align="right" width="60%">  
                                                        <asp:Image ID="Imge" ImageUrl="~/Images/AddRecord.gif" runat="server" /><asp:LinkButton  
                                                            ID="btn_Add" Font-Size="10px" Text="Add New" Font-Underline="true" runat="server" 
                                                            CommandName="InitInsert" Enabled="true" ToolTip="Add New Record"></asp:LinkButton> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </CommandItemTemplate> 
                                        <EditFormSettings PopUpSettings-Modal="true" PopUpSettings-Width="840px" EditFormType="Template">  
                                            <FormTemplate> 
                                                <table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #ffffff;  
                                                    padding-left: 10px" height="30px">  
                                                    <tr> 
                                                        <td class="select_parameter" align="left" style="width: 100px">  
                                                            Priority Order  
                                                        </td> 
                                                        <td align="left" style="width: 60px">  
                                                            <telerik:RadComboBox ID="rdcmbSPriorityOrder" runat="server" Width="55px">  
                                                            </telerik:RadComboBox> 
                                                        </td> 
                                                        <td class="select_parameter" align="left" style="width: 60px">  
                                                            Strategy  
                                                        </td> 
                                                        <td align="left" style="width: 70%">  
                                                            <telerik:RadTextBox ID="txtStrategy" MaxLength="250" Text='<% #Bind("Strategy") %>' 
                                                                Width="100%" runat="server" Font-Names="verdana" Font-Size="10px" Wrap="true" 
                                                                Height="15px">  
                                                            </telerik:RadTextBox> 
                                                        </td> 
                                                        <td align="right" colspan="8" style="padding-right: 20px; width: 80px">  
                                                            <asp:ImageButton ID="ImageButton3" ToolTip='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' 
                                                                runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>' 
                                                                ImageUrl="~/images/Update.gif" OnClientClick="if(!validationStrategy())return false;">  
                                                            </asp:ImageButton> 
                                                            &nbsp;  
                                                            <asp:ImageButton ID="ImageButton4" runat="server" CausesValidation="false" CommandName="Cancel" 
                                                                ToolTip="Cancel" ImageUrl="~/images/Cancel.gif" OnClientClick="if(!CancelValidation())return false;" /> 
                                                        </td> 
                                                    </tr> 
                                                </table> 
                                            </FormTemplate> 
                                        </EditFormSettings> 
                                    </telerik:GridTableView> 
                                    <%--Strategy Grid Ends--%> 
                                </DetailTables> 
                                <Columns> 
                                    <%--Objective Grid Column--%> 
                                    <telerik:GridBoundColumn DataField="GoalID" UniqueName="GoalID" HeaderText="GoalID" 
                                        Visible="false">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="ObjectiveID" UniqueName="ObjectiveID" HeaderText="ObjectiveID" 
                                        Visible="false">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridBoundColumn DataField="PriorityOrder" UniqueName="PriorityOrder" HeaderText="#" 
                                        Visible="true" ItemStyle-Width="30px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">  
                                    </telerik:GridBoundColumn> 
                                    <telerik:GridTemplateColumn HeaderText="Objective" Visible="true" UniqueName="Objective" 
                                        ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">  
                                        <ItemTemplate> 
                                            <asp:Label ID="lblOb" runat="server" Text='<%#Bind("Objective")%>'></asp:Label> 
                                            <asp:ImageButton ID="imgbtnChange" ImageUrl='<%#Bind("RDLogoPath")%>' CommandName="RDChange" 
                                                Enabled="true" CssClass="MyImageButton" runat="server" OnClientClick="if(!CancelChanges())return false;" /> 
                                        </ItemTemplate> 
                                        <ItemStyle Width="80%" HorizontalAlign="Left" /> 
                                        <HeaderStyle Width="80%" HorizontalAlign="Center" /> 
                                    </telerik:GridTemplateColumn> 
                                    <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="EditCommandColumn" HeaderStyle-HorizontalAlign="Center" 
                                        ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                        <ItemTemplate> 
                                            &nbsp;<asp:ImageButton ID="btnEdit" ToolTip="Edit" runat="server" ImageUrl="~/images/Edit.gif" 
                                                CommandName="Edit" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                        </ItemTemplate> 
                                        <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                        <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                    </telerik:GridTemplateColumn> 
                                    <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="DeleteCommandColumn" 
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" AllowFiltering="false">  
                                        <ItemTemplate> 
                                            &nbsp;<asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" ImageUrl="~/images/Delete.gif" 
                                                CommandName="Delete" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                        </ItemTemplate> 
                                        <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                        <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                                    </telerik:GridTemplateColumn> 
                                </Columns> 
                                <CommandItemTemplate> 
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">  
                                        <tr> 
                                            <td width="40%" align="left" style="padding-left: 10px">  
                                                <%--   <asp:CheckBox ID="chkViewFilter" runat="server" Checked="false" onclick="showFilterItemGrid2(this)" /> 
                                                        <asp:Label ID="Label4" runat="server" Text=" Show Filter"></asp:Label>--%> 
                                                <asp:Label ID="lblObjective" runat="server" Text="Objective"></asp:Label> 
                                            </td> 
                                            <td align="right" style="padding-right: 15px">  
                                            </td> 
                                            <td align="right" width="60%">  
                                                <asp:Image ID="Imge" ImageUrl="~/Images/AddRecord.gif" runat="server" /><asp:LinkButton  
                                                    ID="btn_Add" Font-Size="10px" Text="Add New" Font-Underline="true" runat="server" 
                                                    CommandName="InitInsert" Enabled="true" ToolTip="Add New Record"></asp:LinkButton> 
                                            </td> 
                                        </tr> 
                                    </table> 
                                </CommandItemTemplate> 
                                <EditFormSettings PopUpSettings-Modal="true" PopUpSettings-Width="100%" EditFormType="Template">  
                                    <FormTemplate> 
                                        <table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #ffffff;  
                                            padding-left: 10px" height="30px">  
                                            <tr> 
                                                <td class="select_parameter" align="left" style="width: 80px">  
                                                    Priority Order  
                                                </td> 
                                                <td align="left" style="width: 60px">  
                                                    <telerik:RadComboBox ID="rdcmbOPriorityOrder" runat="server" Width="55px" Height="15px">  
                                                    </telerik:RadComboBox> 
                                                </td> 
                                                <td class="select_parameter" align="left" style="width: 60px">  
                                                    Objective  
                                                </td> 
                                                <td align="left" style="width: 70%">  
                                                    <telerik:RadTextBox ID="txtObjective" MaxLength="250" Text='<% #Bind("Objective") %>' 
                                                        Width="100%" runat="server" Font-Names="verdana" Font-Size="10px" Wrap="true" 
                                                        Height="15px">  
                                                    </telerik:RadTextBox> 
                                                </td> 
                                                <td align="right" colspan="8" style="padding-right: 20px; width: 80px">  
                                                    <asp:ImageButton ID="ImageButton1" ToolTip='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' 
                                                        runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>' 
                                                        ImageUrl="~/images/Update.gif" OnClientClick="if(!validationObjective())return false;">  
                                                    </asp:ImageButton> 
                                                    &nbsp;  
                                                    <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="false" CommandName="Cancel" 
                                                        ToolTip="Cancel" ImageUrl="~/images/Cancel.gif" OnClientClick="if(!CancelValidation())return false;" /> 
                                                </td> 
                                            </tr> 
                                        </table> 
                                    </FormTemplate> 
                                </EditFormSettings> 
                            </telerik:GridTableView> 
                            <%--Objective Grid Ends--%> 
                        </DetailTables> 
                        <Columns> 
                            <%--Goal Grid Column--%> 
                            <telerik:GridBoundColumn DataField="GoalID" UniqueName="GoalID" HeaderText="GoalID" 
                                Visible="false">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="PriorityOrder" UniqueName="PriorityOrder" HeaderText="#" 
                                Visible="true" ItemStyle-Width="30px" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" 
                                HeaderStyle-Width="30px">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridTemplateColumn HeaderText="Goal" Visible="true" UniqueName="Goal" ItemStyle-Wrap="true" 
                                ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">  
                                <ItemTemplate> 
                                    <asp:Label ID="lblG" runat="server" Text='<%#Bind("Goal")%>'></asp:Label> 
                                    <asp:ImageButton ID="imgbtnChange" ImageUrl='<%#Bind("RDLogoPath")%>' CommandName="RDChange" 
                                        Enabled="true" CssClass="MyImageButton" runat="server" OnClientClick="if(!CancelChanges())return false;" /> 
                                </ItemTemplate> 
                                <ItemStyle Width="80%" HorizontalAlign="Left" /> 
                                <HeaderStyle Width="80%" HorizontalAlign="Center" /> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="Edit" UniqueName="EditCommandColumn" HeaderStyle-HorizontalAlign="Center" 
                                ItemStyle-HorizontalAlign="Center" AllowFiltering="false" Resizable="false">  
                                <ItemTemplate> 
                                    &nbsp;<asp:ImageButton ID="btnEdit" ToolTip="Edit" runat="server" ImageUrl="~/images/Edit.gif" 
                                        CommandName="Edit" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                </ItemTemplate> 
                                <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="Delete" UniqueName="DeleteCommandColumn" 
                                Resizable="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" 
                                AllowFiltering="false">  
                                <ItemTemplate> 
                                    &nbsp;<asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" ImageUrl="~/images/Delete.gif" 
                                        CommandName="Delete" CssClass="MyImageButton" Enabled="true" />&nbsp;  
                                </ItemTemplate> 
                                <ItemStyle Width="40px" HorizontalAlign="Center" /> 
                                <HeaderStyle Width="40px" HorizontalAlign="Center" /> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                        <CommandItemTemplate> 
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
                                <tr> 
                                    <td width="40%" align="left" style="padding-left: 10px">  
                                        <%--   <asp:CheckBox ID="chkViewFilter" runat="server" Checked="false" onclick="showFilterItemGrid2(this)" /> 
                                                        <asp:Label ID="Label4" runat="server" Text=" Show Filter"></asp:Label>--%> 
                                        <asp:Label ID="lblGoal" runat="server" Text="Goal"></asp:Label> 
                                    </td> 
                                    <td align="right" style="padding-right: 15px">  
                                    </td> 
                                    <td align="right" width="60%">  
                                        <asp:ImageButton ID="imgbtnExport" OnClick="btn_ExportToExcel_Click" ImageUrl="~/images/icon_excel.gif" 
                                            runat="server" ToolTip="Export To Excel" />&nbsp;&nbsp;  
                                        <asp:Image ID="Imge" ImageUrl="~/Images/AddRecord.gif" runat="server" /><asp:LinkButton  
                                            ID="btn_Add" Font-Size="10px" Text="Add New" Font-Underline="true" runat="server" 
                                            CommandName="InitInsert" Enabled="true" ToolTip="Add New Record"></asp:LinkButton> 
                                    </td> 
                                </tr> 
                            </table> 
                        </CommandItemTemplate> 
                        <EditFormSettings PopUpSettings-Modal="true" PopUpSettings-Width="900px" EditFormType="Template">  
                            <FormTemplate> 
                                <table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #ffffff;  
                                    padding-left: 10px" height="30px">  
                                    <tr> 
                                        <td class="select_parameter" align="left" style="width: 80px">  
                                            Priority Order  
                                        </td> 
                                        <td align="left" style="width: 60px">  
                                            <telerik:RadComboBox ID="rdcmbGPriorityOrder" runat="server" Width="55px" Height="15px">  
                                            </telerik:RadComboBox> 
                                        </td> 
                                        <td class="select_parameter" align="left" style="width: 40px">  
                                            Goal  
                                        </td> 
                                        <td align="left" style="width: 70%">  
                                            <telerik:RadTextBox ID="txtGoal" MaxLength="250" Text='<% #Bind("Goal") %>' Width="100%" 
                                                runat="server" Font-Names="verdana" Font-Size="10px" Wrap="true" Height="15px">  
                                            </telerik:RadTextBox> 
                                        </td> 
                                        <td align="right" style="padding-right: 20px; width: 80px">  
                                            <asp:ImageButton ID="imgGUpdate" ToolTip='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' 
                                                runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>' 
                                                ImageUrl="~/images/Update.gif" OnClientClick="if(!validationGoal())return false;">  
                                            </asp:ImageButton> 
                                            &nbsp;  
                                            <asp:ImageButton ID="imgGCancel" runat="server" CausesValidation="false" CommandName="Cancel" 
                                                ToolTip="Cancel" ImageUrl="~/images/Cancel.gif" OnClientClick="if(!CancelValidation())return false;" /> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </FormTemplate> 
                        </EditFormSettings> 
                        <%--Goal Grid Ends--%> 
                    </MasterTableView> 
                </telerik:RadGrid> 
and below is the code which i tried to achieve my result:
if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))  
            {  
                if (e.Item.OwnerTableView.Name == "Goals")  
                {  
                    foreach (GridCommandItem cmdItm in e.Item.OwnerTableView.GetItems(GridItemType.CommandItem))  
                    {  
                        LinkButton Addbtn = (LinkButton)cmdItm.FindControl("btn_Add");  
                        Addbtn.Enabled = false;  
 
                    }  
                    GridTableView nestedTableView = (rdGOSTView.MasterTableView.Items[0] as GridDataItem).ChildItem.NestedTableViews[0];  
                    foreach (GridEditableItem editItm in nestedTableView.GetItems(GridItemType.EditItem))  
                    {  
                        ImageButton Delbtn = (ImageButton)editItm.FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)editItm.FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
 
                    //For Goals  
                    //for (int i = 0; i < e.Item.OwnerTableView.Items.Count; i++)  
                    //{  
 
                    //    ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnDelete");  
                    //    if (Delbtn != null)  
                    //        Delbtn.Enabled = false;  
                    //    ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnEdit");  
                    //    if (btnEdit != null)  
                    //        btnEdit.Enabled = false;  
                    //}  
                }  
                if (e.Item.OwnerTableView.Name == "Objectives")  
                {  
                    foreach (GridCommandItem cmdItm in e.Item.OwnerTableView.GetItems(GridItemType.CommandItem))  
                    {  
                        LinkButton Addbtn = (LinkButton)cmdItm.FindControl("btn_Add");  
                        Addbtn.Enabled = false;  
 
                    }  
                    //For Objective  
                    for (int i = 0; i < e.Item.OwnerTableView.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                    //For Goals  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
 
                }  
                if (e.Item.OwnerTableView.Name == "Strategy")  
                {  
                    foreach (GridCommandItem cmdItm in e.Item.OwnerTableView.GetItems(GridItemType.CommandItem))  
                    {  
                        LinkButton Addbtn = (LinkButton)cmdItm.FindControl("btn_Add");  
                        Addbtn.Enabled = false;  
 
                    }  
                    //For Strategy  
                    for (int i = 0; i < e.Item.OwnerTableView.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                    //For Goals  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                    //For Objecives  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                }  
                if (e.Item.OwnerTableView.Name == "Tactics")  
                {  
                    foreach (GridCommandItem cmdItm in e.Item.OwnerTableView.GetItems(GridItemType.CommandItem))  
                    {  
                        LinkButton Addbtn = (LinkButton)cmdItm.FindControl("btn_Add");  
                        Addbtn.Enabled = false;  
 
                    }  
                    //For Tactics  
                    for (int i = 0; i < e.Item.OwnerTableView.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
 
                    //For Goals  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                    //For Objecives  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
                    //For Strategy  
                    for (int i = 0; i < e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.MasterTableView.OwnerGrid.Items.Count; i++)  
                    {  
 
                        ImageButton Delbtn = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnDelete");  
                        if (Delbtn != null)  
                            Delbtn.Enabled = false;  
                        ImageButton btnEdit = (ImageButton)e.Item.OwnerTableView.OwnerGrid.MasterTableView.OwnerGrid.MasterTableView.OwnerGrid.Items[i].FindControl("btnEdit");  
                        if (btnEdit != null)  
                            btnEdit.Enabled = false;  
                    }  
 
                }  
            } 

i have given you all the code which i tried to get my result but still i am not successfull. Please help me.

Guys if any one has any solution please post....

Thanks a lot to Telerik and all the members in advance.
waiting for reply.

3 Answers, 1 is accepted

Sort by
0
Binod
Top achievements
Rank 1
answered on 06 Apr 2010, 01:23 PM
Hi Telerik

Here i am attaching a image which will help you to get the scenario as my requirement. In this image i am editing the item of 4th level grid and in this case others grid's edit/delete button should be disabled.

waiting for reply.
thanks a lot in advance.
0
Yavor
Telerik team
answered on 08 Apr 2010, 09:56 AM
Hi Binod,

One possible option in this case would be to iterate through all the items in the hierarchy, in the PreRender event handler:

http://www.telerik.com/help/aspnet-ajax/grdtraversingdetailtablesitemsingrid.html

for each table, you can access the .Items collection. For each GridDataItem within the items collection, you can access the relevant cells:

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

and disable the relevant elements.
I hope this information helps.

Best wishes,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Binod
Top achievements
Rank 1
answered on 08 Apr 2010, 11:42 AM
Hi Telerik

i couldn't here anything till now...please reply.

Guys if anyone having any idea about it please reply...

Thanks a lot in advance
Tags
Grid
Asked by
Binod
Top achievements
Rank 1
Answers by
Binod
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or