Multiple controls with the same ID 'FilterTextBox_?? when using UniqueName

2 posts, 0 answers
  1. Bob
    Bob avatar
    1 posts
    Member since:
    Jul 2017

    Posted 08 Aug 2017 Link to this post

    I have created a Grid ServerSide.  The first time the grid loads it is fine, but any time a subsequent load happens I get the above error for any column where I am trying to set a UniqueName.  I am clearing out all columns before new ones are created so I don't see why I am getting this.  Here is a snippit of my code:

    // Clear all Grid Columns to start from scratch
    RadGrid.MasterTableView.Columns.Clear();
     
    foreach (string column in columns)
    {
        if (column.ToLower() == "recordid")
        {
            RadGrid.MasterTableView.ClientDataKeyNames = new string[] { column };
            RadClientDataSource1.Schema.Model.ID = column;
            continue;
        }
     
        GridBoundColumn col = new GridBoundColumn()
        {
            DataField = column,
            UniqueName = column,
            HeaderText = column.Replace("_", " "),
            FilterDelay = 300
        };
     
        RadGrid1.MasterTableView.Columns.Add(col);
    }
  2. Eyup
    Admin
    Eyup avatar
    3817 posts

    Posted 11 Aug 2017 Link to this post

    Hi Bob,

    There is no need to clear the columns so please remove this line. Also, make sure that you are creating the grid entirely on code-behind during the Page_Init event handler as demonstrated in the following section:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/creating-a-radgrid-programmatically#creating-a-radgrid-on-page_init

    If you want to change the columns dynamically, please follow the steps explained in this article:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/defining-structure/changing-the-grid-structure-dynamically-on-postback

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top