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.
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";
}
}