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

Heirarchy expand/collapse image list when load mode is condition

3 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew R Longhouse
Top achievements
Rank 1
Matthew R Longhouse asked on 03 Jan 2014, 06:51 PM
I have a basic grid for testing that has a content area for each row that can be expanded.  I am setting a custom image for the expand and collapse image.  This was confusing already as I tried a few different techniques to get it working.  Using an ExpandCollapseColumn element in markup seemed to do nothing, however, I was able to get it to work by using the properties on the master table element or by setting them in the column creation event in the code behind.

My problem is that no matter how I specify the images, they are lost after I expand a row and then collapse it.  Once collapsed the image src is shown as undefined in the browser.  The hierarchy loading mode is conditional.  The problem doesn't happen if I set it to "server on demand" or client.  I can't think of a reason why this would be by design, and I think the grid should be able to track its expand and collapse images especially if it can do so in client mode.

In the example I am setting the images in 2 different ways, and it still has the same issue.
<telerik:RadGrid ID="grdHeirarchyLoadTest" AutoGenerateColumns="false" OnColumnCreated="RadGrid1_ColumnCreated" ExpandCollapseColumn-CollapseImageUrl="~/images/arrow_expanded.gif" ExpandCollapseColumn-ExpandImageUrl="~/images/arrow_collapsed.gif" runat="server">
    <MasterTableView HierarchyLoadMode="Conditional" ExpandCollapseColumn-ButtonType="ImageButton">
        <Columns>
            <Telerik:GridBoundColumn DataField="Test" HeaderText="Test" />
        </Columns>
        <NestedViewTemplate>
            Test content
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    if (e.Column is GridExpandColumn)
    {
        (e.Column as GridExpandColumn).ButtonType = GridExpandColumnType.ImageButton;
        (e.Column as GridExpandColumn).ExpandImageUrl = "~/images/arrow_collapsed.gif";
        (e.Column as GridExpandColumn).CollapseImageUrl = "~/images/arrow_expanded.gif";
    }
}

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 08 Jan 2014, 01:14 PM
Hello Matthew,

You could use the following CSS rule to override the default image icons.
<style type="text/css">
   .rgExpand 
    
      background:url('../../images/expand.png') center center no-repeat !important;      
    
   
   .rgCollapse 
    
      background:url('../../images/collapse.png') center center no-repeat !important
    
</style>

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Matthew R Longhouse
Top achievements
Rank 1
answered on 09 Jan 2014, 02:41 PM
I'm not just interested in a workaround but whether there is a bug with your product or if I am using it wrong.  If it is a bug I would like to submit it.  It is frustrating trying different methods to try and figure out which one works as intended.
0
Accepted
Kostadin
Telerik team
answered on 14 Jan 2014, 12:39 PM
Hi Matthew,

I am afraid that this is a bug and I have already forwarded it to one of our developers for further investigation.

Please excuse us for any inconvenience this might have caused you. Your Telerik points have been updated accordingly.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Matthew R Longhouse
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Matthew R Longhouse
Top achievements
Rank 1
Share this question
or