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

Collapse all rows by default and show expand/collpase images for all rows having child rows

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krishnan LN
Top achievements
Rank 1
Krishnan LN asked on 20 Mar 2010, 07:07 AM
Hi,
Im using the self referencing grid. By default all the rows are in expanded state but i want to collapse all rows and expand only on click.
I want to use Plus/Minus image instead of default button. But the plus/minus image appears only for parent row amd for the rest normal button is shown.

Following is the aspx grid definition

    <telerik:RadPageView ID="RadPageView2" runat="server">  
        <table border="0" visible"false" width="100%">  
 <LNWCon:LNGrid ID="grdOrganization" EnableAJAX="True" ShowHeader="true" runat="server"   
Width"97%" GridLines="None" OnColumnCreated="grdOrganization_ColumnCreated" OnItemCreated="grdOrganization_ItemCreated" 
           OnNeedDataSource"grdOrganization_NeedDataSource" OnItemDataBound = "grdOrganization_ItemDataBound" OnItemCommand="grdOrganization_ItemCommand" Skin="Black" AutoGenerateColumns="False" > 
           <MasterTableView HierarchyDefaultExpanded="true" HierarchyLoadMode="Client" NoDetailRecordsText="No Records To Display" EnableNoRecordsTemplate="false" 
               DataKeyNames"FolderId,ParentFolderId" Width="100%" HorizontalAlign="Right" ExpandCollapseColumn-ButtonType="ImageButton" ExpandCollapseColumn-CollapseImageUrl="../Images/minus.png" ExpandCollapseColumn-ExpandImageUrl="../Images/plus.png"  ExpandCollapseColumn-Visible="true"


Any help is appreciated.

Regards,
L.N.K

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 24 Mar 2010, 05:12 PM
Hello Krishnan LN,

You can have a table in your grid collapsed after each postback by setting the HierarchyDefaultExpanded property of the respective MasterTableView/GridTableView to false.

As to changing the Expand / Collapse images you should use the following CSS rules:

<style type="text/css">
        .rgExpand
        {
            background: url('MyImageFolder/MyExpandedImage.gif') center center no-repeat !important;
        }
        .rgCollapse
        {
            background: url('MyImageFolder/MyCollapsed.gif') center center no-repeat !important;
        }
    </style>

I hope this helps,
Martin
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.
Tags
Grid
Asked by
Krishnan LN
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or