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

expand the radgrid hierarchy in expand column commandname

2 Answers 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Srinivasa Gokidi
Top achievements
Rank 1
Srinivasa Gokidi asked on 20 Dec 2010, 03:41 PM
HI,
I using rad grid hierarchy. If i dont have any commandname for expandcollapse column the grid is expanding. But if have a commandname. The grid is not expanding. Is there any code do i need to write in commandname. Please help me. I searched online but i didn't find any solution. Here si my sample code

<telerik:RadGrid ID="RGCMnbr" runat="server" AutoGenerateColumns="false" Height="520px"
                                                                    BorderWidth="1px" BorderStyle="Solid" GridLines="None" BackColor="White" AllowPaging="True"
                                                                    PageSize="20" AllowSorting="True" OnNeedDataSource="RGCMnbr_OnNeedDataSource"
                                                                    EnableEmbeddedSkins="false" ShowGroupPanel="false" ShowStatusBar="false" OnItemDataBound="RGCMnbr_ItemDataBound"
                                                                    OnItemCommand="RGCMnbr_ItemCommand" MasterTableView-RowIndicatorColumn-Display="false"
                                                                    OnDetailTableDataBind="RGCMnbr_DetailTableDataBind">
                                                                    <HeaderStyle Height="20px" BackColor="#004000" Font-Size="8pt" Font-Bold="True" ForeColor="White"
                                                                        HorizontalAlign="Center" BorderColor="White" BorderWidth="1px" />
                                                                    <ItemStyle HorizontalAlign="Center" />
                                                                    <AlternatingItemStyle BackColor="#F5F5E9" HorizontalAlign="Center" />
                                                                    <PagerStyle BackColor="#F5F5E9" />
                                                                    <MasterTableView DataKeyNames="cmId" Name="Master" GridLines="None" ExpandCollapseColumn-ButtonType="ImageButton"
                                                                        ExpandCollapseColumn-CollapseImageUrl="Images/Right.gif" ExpandCollapseColumn-ExpandImageUrl="Images/Right.gif" ExpandCollapseColumn-CommandName="Expand">
                                                                        <DetailTables>
                                                                            <telerik:GridTableView Name="Orders" Width="80%" DataKeyNames="smId">
                                                                                <HeaderStyle Height="15px" BackColor="#004000" Font-Size="8pt" Font-Bold="True" ForeColor="White"
                                                                                    HorizontalAlign="Center" BorderColor="White" BorderWidth="1px" />
                                                                                <ItemStyle HorizontalAlign="Center" />
                                                                                <AlternatingItemStyle HorizontalAlign="Center" />
                                                                                <Columns>
                                                                                    <telerik:GridBoundColumn UniqueName="smId" DataField="smId" HeaderText="smId" Visible="false">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="SM Number" UniqueName="smNumber" DataField="smNumber">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="Sch Imp Date" DataField="smSchImpDate" UniqueName="smSchImpDate"
                                                                                        DataFormatString="{0:MM/dd/yyyy}">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="SM Status" DataField="smStatus" UniqueName="smStatus">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="Created Date" DataField="smCreatedDate" UniqueName="smCreatedDate"
                                                                                        DataFormatString="{0:MM/dd/yyyy}">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="Created By" DataField="smCreatedBy" UniqueName="smCreatedBy">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridBoundColumn HeaderText="Approved Date" DataField="smApprovedDate" UniqueName="smApprovedDate"
                                                                                        DataFormatString="{0:MM/dd/yyyy}">
                                                                                    </telerik:GridBoundColumn>
                                                                                    <telerik:GridButtonColumn UniqueName="EditSMNbr" CommandName="EditSM" ButtonType="ImageButton"
                                                                                        ImageUrl="~/Images/edit-icon-v5.gif" HeaderStyle-Width="5%" ItemStyle-Width="5%">
                                                                                    </telerik:GridButtonColumn>
                                                                                    <telerik:GridButtonColumn UniqueName="DeleteSmNbr" CommandName="DeleteSM" ButtonType="ImageButton"
                                                                                        ImageUrl="~/Images/Delete.gif" HeaderStyle-Width="5%" ItemStyle-Width="5%">
                                                                                    </telerik:GridButtonColumn>
                                                                                </Columns>
                                                                                <NoRecordsTemplate>
                                                                                    No SM numbers to dispaly</NoRecordsTemplate>
                                                                            </telerik:GridTableView>
                                                                        </DetailTables>
                                                                        <Columns>
                                                                            <telerik:GridBoundColumn UniqueName="cmId" HeaderText="cmId" DataField="cmId" Visible="false"
                                                                                ReadOnly="true">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn DataField="CMNumber" UniqueName="CMNumber" HeaderText="CM Number">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="CM Type" DataField="CMType" UniqueName="CMType">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridTemplateColumn HeaderText="Dependent Sites" DataField="DependentSites"
                                                                                UniqueName="DependentSites">
                                                                                <ItemTemplate>
                                                                                    <asp:LinkButton Text='<%# Bind("DependentSites") %>' runat="server" ID="lnkDepenSites"
                                                                                        CommandName="Orders"></asp:LinkButton>
                                                                                </ItemTemplate>
                                                                            </telerik:GridTemplateColumn>
                                                                            <telerik:GridBoundColumn HeaderText="Req Imp Date" DataField="ReqImpDate" UniqueName="ReqImpDate"
                                                                                DataFormatString="{0:MM/dd/yyyy}">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="CM Status" DataField="CMStatus" UniqueName="CMStatus">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="CM Step Number" DataField="CMStepNumber" UniqueName="CMStepNumber">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="CM Step Status" DataField="CMStepStaus" UniqueName="CMStepStaus">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="Create Date" DataField="CreatedDate" UniqueName="CreatedDate"
                                                                                DataFormatString="{0:MM/dd/yyyy}">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="Created By" DataField="CreatedBy" UniqueName="CreatedBy">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridBoundColumn HeaderText="Approved Date" DataField="ApprovedDate" UniqueName="ApprovedDate"
                                                                                DataFormatString="{0:MM/dd/yyyy}">
                                                                            </telerik:GridBoundColumn>
                                                                            <telerik:GridButtonColumn UniqueName="EditCMNbr" CommandName="EditCM" ImageUrl="~/Images/edit-icon-v5.gif"
                                                                                ButtonType="ImageButton" HeaderStyle-Width="3%" ItemStyle-Width="3%">
                                                                            </telerik:GridButtonColumn>
                                                                            <telerik:GridButtonColumn UniqueName="AddSMNbr" CommandName="AddSM" ImageUrl="~/Images/add-icon.png"
                                                                                ButtonType="ImageButton" HeaderStyle-Width="3%" ItemStyle-Width="3%">
                                                                            </telerik:GridButtonColumn>
                                                                        </Columns>
                                                                        <NoRecordsTemplate> No CM numbers to display</NoRecordsTemplate>
                                                                    </MasterTableView>
                                                                    <ClientSettings>
                                                                        <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="450px" />
                                                                    </ClientSettings>
                                                                </telerik:RadGrid>




if (e.CommandName == "Expand")
{
    GridDataItem dataItem = (GridDataItem)e.Item;
    lblCMNbr.Text = dataItem["CMNumber"].Text.Trim();
    lblReqImpDt.Text = dataItem["ReqImpDate"].Text.Trim();
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Dec 2010, 05:54 AM
Hello Srinivasa Gokidi,

You need to set the commandName for ExpandCollapse column as 'ExpandCollapse' like below.

ASPX:
<MasterTableView ExpandCollapseColumn-CommandName="ExpandCollapse">

Thanks,
Princy.
0
Srinivasa Gokidi
Top achievements
Rank 1
answered on 21 Dec 2010, 03:57 PM
Thanks Princy,

Its working. Once again Thanks.
Tags
Grid
Asked by
Srinivasa Gokidi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Srinivasa Gokidi
Top achievements
Rank 1
Share this question
or