You must override Clone() method for derived grid column

6 posts, 0 answers
  1. Ketaki
    Ketaki avatar
    2 posts
    Member since:
    Mar 2009

    Posted 03 Mar 2009 Link to this post



    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
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 04 Mar 2009 Link to this post

    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.
  3. Ketaki
    Ketaki avatar
    2 posts
    Member since:
    Mar 2009

    Posted 04 Mar 2009 Link to this post



    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.

     

  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 07 Mar 2009 Link to this post

    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.
  5. Ahmad
    Ahmad avatar
    15 posts
    Member since:
    Jul 2010

    Posted 05 Aug 2018 Link to this post

    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

  6. Tsvetomir
    Admin
    Tsvetomir avatar
    651 posts

    Posted 08 Aug 2018 Link to this post

    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.
Back to Top