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

[Solved] Inheriting Grid (best practices)

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Villemure
Top achievements
Rank 1
Eric Villemure asked on 15 Feb 2008, 02:56 PM
Hi, we have inherited the Prometheus Grid and we are wondering what are the best practices when it comes to use events.

Is it better to use event handlers or override the On... function?

For example

   public class Grid : Telerik.Web.UI.RadGrid
    {
       
        protected override bool OnNeedDataSource(Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            bool baseValue = base.OnNeedDataSource(e);

             do stuff here

            return baseValue;
        }

    }


Or I could have done in the Grid() constructor adding a event and implementing the previous code in the event handler.

I am wondering what is the best practice?

Thanks

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 18 Feb 2008, 04:41 PM
Hello Eric Villemure,

Basically same practices as for building custom controls and general objects apply here too.
Therefore I think it's more suitable to override the methods as you are "building" the control as opposite to wrapping the control for example as part of CompositeControl.

Best wishes,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Eric Villemure
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or