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

RadTileList1.getAllItems.Remove(tile) does NOT work?

1 Answer 62 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 29 Apr 2014, 02:43 AM
I have a RadTileList that includes Tiles in the ASPX markup as well as others that are dynamically created on the server (not databound).

Why can't I remove a RadTile that was defined in the ASPX markup from the code behind?  in the snippet below - the tile reference is found - but .Remove does nothing.  

Dim tile = RadTileList1.GetAllTiles.Find(Function(x) x.ID = item.ID)
If tile IsNot Nothing Then
    RadTileList1.GetAllTiles.Remove(tile)
End If

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 29 Apr 2014, 11:23 AM

Hi Dan,

You should remove the tile from the group, not from the collection of all tiles. The GetAllTiles() method merely returns a list of all tiles in the TileList, but it is not an editable collection.

Here is a simple example of looping through the groups and tiles to remove the desired one:

<telerik:RadTileList runat="server" ID="RadTileList1">
    <Groups>
        <telerik:TileGroup>
            <telerik:RadTextTile Text="first" Name="one"></telerik:RadTextTile>
            <telerik:RadTextTile Text="second" Name="two"></telerik:RadTextTile>
        </telerik:TileGroup>
        <telerik:TileGroup>
            <telerik:RadTextTile Text="three" Name="three"></telerik:RadTextTile>
            <telerik:RadTextTile Text="four" Name="four"></telerik:RadTextTile>
        </telerik:TileGroup>
    </Groups>
</telerik:RadTileList>
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Dim desiredTileId As String = "two"
    Dim wantedTile As RadBaseTile = RadTileList1.GetTileByName("two")
    For Each Group As TileGroup In RadTileList1.Groups
        For Each tile As RadBaseTile In Group.GetAllTiles()
            If tile.Name = wantedTile.Name Then
                Group.Tiles.Remove(tile)
                Exit For
            End If
        Next
    Next
End Sub

 I am also logging the idea to expose a RemoveTile() method from the TileList object so it can be used directly in a similar fashion as the code you have tried: http://feedback.telerik.com/Project/108/Feedback/Details/127116-add-a-method-to-remove-a-tile-from-radtilelist.

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TileList
Asked by
Dan
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or