Question about MasterGridViewTemplate and MasterTemplate

4 posts, 0 answers
  1. Martin Horst
    Martin Horst avatar
    39 posts
    Member since:
    Apr 2010

    Posted 18 Aug 2010 Link to this post

    Hi,

    the MasterGridViewTemplate is marked as obsolete so I tried to use the
    MasterTemplate property inside the designer. But this is not possible because
    the new MasterTemplate property is also marked as not browsable. Why is it not
    allowed to this property inside the designer any more.

    Regards
    Martin
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 23 Aug 2010 Link to this post

    Hello Martin Horst,

    Thank you for contacting us.

    In the new version we exposed all MasterGridViewTemplate properties to the RadGridView control, so there is no need of the MasterTemplate at design-time. In addition, from the smart tag you can change DataSource, Columns, Templates, Relations, FilterDescriptors, GroupDescriptors, SortDescriptors of the MasterTemplate object.

    I hope this information is useful. Let me know if you need further assistance.

    Sincerely yours,
    Julian Benkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Anders
    Anders avatar
    8 posts
    Member since:
    Sep 2012

    Posted 05 Sep 2012 Link to this post

    what if we want to programmatically edit the template to get a certain type of functionality and link it to a gridview we create in the designer?
  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 06 Sep 2012 Link to this post

    Hi Anders,

    You can override the default RadGridViewElement and the MasterGridViewTemplate to add your custom properties and behavior. Here is an example:
    using System.Windows.Forms;
    using Telerik.WinControls.UI;
    using Telerik.WinControls.UI.Data;
     
    namespace Lab.Grid
    {
        public partial class GridOverrideViewAndTemplateForm : Form
        {
            class MyMasterTemplate : MasterGridViewTemplate
            {
                public MyMasterTemplate()
                {
                    this.DataSource = new ValueList<double>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
                }
            }
     
            class MyGridViewElement : RadGridViewElement
            {
                protected override MasterGridViewTemplate CreateTemplate()
                {
                    return new MyMasterTemplate();
                }
            }
     
            class MyGrid : RadGridView
            {
                protected override RadGridViewElement CreateGridViewElement()
                {
                    return new MyGridViewElement();
                }
            }
     
            public GridOverrideViewAndTemplateForm()
            {
                InitializeComponent();
     
                MyGrid grid = new MyGrid();
                grid.Dock = DockStyle.Fill;
                grid.Parent = this;
            }
        }
    }

    I hope this helps.

    Regards,
    Julian Benkov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top