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

Create Custom GridView Control

2 Answers 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ShareDocs
Top achievements
Rank 1
ShareDocs asked on 05 Nov 2012, 11:46 AM
Hi,

 I am trying to create my custom gridview controls which inherit from radgridview.

 

The Code:

 

public partial class eRadGridView : Telerik.WinControls.UI.RadGridView

{

public eRadGridView()

        {

            InitializeComponent();

           

        }

 

        public eRadGridView(IContainer container)

        {

            container.Add(this);

 

            InitializeComponent();

        }

    }

 

When I try to droll it from the toolbox, I get the attach error.
Please let me know what I am doing wrong.

2 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 07 Nov 2012, 10:32 AM
Hello,

In your case, the container is null.

But you don't need to do all of these, you could just simply do:
public class eRadGridView : Telerik.WinControls.UI.RadGridView
{
    public eRadGridView()
    {
        // perform initialization here
    }
}


Best Regards,
Emanuel Varga
Winforms MVP
0
Stefan
Telerik team
answered on 08 Nov 2012, 09:05 AM
Hello guys,

Just to add that you will also need to override the ThemeClassName:
public override string ThemeClassName 
        
            get
            
                return typeof(RadGridView).FullName; 
            
        }

as explained here: http://www.telerik.com/support/kb/winforms/themes/inherit-themes-from-radcontrols.aspx.

I hope this helps.
 
All the best,
Stefan
the Telerik team
Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
ShareDocs
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or