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

Question about MasterGridViewTemplate and MasterTemplate

3 Answers 527 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin Horst
Top achievements
Rank 1
Martin Horst asked on 18 Aug 2010, 09:36 AM
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

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 23 Aug 2010, 01:38 PM
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
0
Anders
Top achievements
Rank 1
answered on 05 Sep 2012, 07:11 AM
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?
0
Julian Benkov
Telerik team
answered on 06 Sep 2012, 11:34 AM
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 >>
Tags
GridView
Asked by
Martin Horst
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Anders
Top achievements
Rank 1
Share this question
or