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

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

1 Answer 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Iron
Veteran
Iron
Bob asked on 08 Aug 2017, 08:38 PM

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);
}

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 11 Aug 2017, 07:56 AM
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.
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Eyup
Telerik team
Share this question
or