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

2 posts, 0 answers
  1. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 28 Apr 2014 Link to this post

    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
    End If
  2. Marin Bratanov
    Marin Bratanov avatar
    3567 posts

    Posted 29 Apr 2014 Link to this post

    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">
                <telerik:RadTextTile Text="first" Name="one"></telerik:RadTextTile>
                <telerik:RadTextTile Text="second" Name="two"></telerik:RadTextTile>
                <telerik:RadTextTile Text="three" Name="three"></telerik:RadTextTile>
                <telerik:RadTextTile Text="four" Name="four"></telerik:RadTextTile>
    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
                    Exit For
                End If
    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.


    Marin Bratanov

    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.

  3. Telerik UI for ASP.NET Core is out
Back to Top