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

You must override Clone() method for derived grid column

5 Answers 240 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ketaki
Top achievements
Rank 1
Ketaki asked on 03 Mar 2009, 06:25 AM


Hii

 I am doing google like filtering in two level hierarchy. On first level I do not want filtering. In Second level I want filtering. When I create gridcolumn on page load  and that column in gridtableview & add that girdtableview in mastertable then it shows me error such as "You must override Clone() method for derived grid colimn. Please help me.


Thanks in advance.

Regards,
Ketaki

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Mar 2009, 07:49 AM
Hi Ketaki,

Please check this article for more info:
http://www.telerik.com/help/aspnet-ajax/grdinheritgridcolumns.html

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ketaki
Top achievements
Rank 1
answered on 04 Mar 2009, 08:52 AM


Hi Vlad,

Actually in Design page I am creating mastertable. But in codeing I am writing below code

protected

 

void Page_Load(object sender, EventArgs e)

 

{

 

if (!IsPostBack)

 

{


DataTable

 

dt = GeXYZTable();

 

 

GridTableView gridxyz = new GridTableView(RadGrid1);

 

gridxyz.AllowFilteringByColumn =

true;

 

 

foreach (DataColumn dataColumn in dt.Columns)

 

{

gridxyz.Columns.Clear();

 

if (dataColumn.ColumnName != "Edit" && dataColumn.ColumnName != "Details" && dataColumn.ColumnName != "Status")

 

{

 

//GridBoundColumn gridColumn = new GridBoundColumn ();

 

 

MyCustomFilteringColumnCS gridColumn = new MyCustomFilteringColumnCS();

 

gridxyz.Columns.Add(gridColumn);

gridColumn.DataField = dataColumn.ColumnName;

gridColumn.HeaderText = dataColumn.ColumnName;

gridColumn.ShowSortIcon =

false;

 

}

}

gridxyz.Rebind();

 

 

this.RadGrid1.MasterTableView.DetailTables.Add(gridxyz);
}
}

But it give me error as You must override Clone() method for derived grid column.

 

0
Georgi Krustev
Telerik team
answered on 07 Mar 2009, 04:59 PM
Hello Ketaki,

When inheriting grid columns in hierarchy, you need to override their Clone() method and copy the base properties as follows:
public override GridColumn Clone() 
            RequiredGridBoundColumn requiredGridBoundColumn = new RequiredGridBoundColumn(); 
 
            //you should override CopyBaseProperties if you have some column specific properties 
            requiredGridBoundColumn.CopyBaseProperties(this); 
 
            return requiredGridBoundColumn; 

For further information you can review this online help article (bottom of the page).

Regards, Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ahmad
Top achievements
Rank 1
answered on 05 Aug 2018, 07:36 PM

Hi

I know it's been years since this thread has been active, but I've been wondering if it's possible to get a little help in "you should override CopyBaseProperties if you have some column specific properties" part. Would you please provide a sample, I would be really grateful.

Thanks in advance

0
Tsvetomir
Telerik team
answered on 08 Aug 2018, 02:15 PM
Hi Ahmad,

This info is mentioned here:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/inheritance/inheriting-grid-columns

Essentially, if you would like to create a custom grid column, please check the third solution provided in the following post: Custom Grid Column. Additionally, you can also have a look at this article:
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/filtering/google-like-filtering

Hope this helps.

Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Ketaki
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ketaki
Top achievements
Rank 1
Georgi Krustev
Telerik team
Ahmad
Top achievements
Rank 1
Tsvetomir
Telerik team
Share this question
or