Create Custom GridView Control

3 posts, 0 answers
  1. ShareDocs
    ShareDocs avatar
    79 posts
    Member since:
    Oct 2012

    Posted 05 Nov 2012 Link to this post

    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. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 07 Nov 2012 Link to this post

    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

  3. DevCraft Release
  4. Stefan
    Admin
    Stefan avatar
    2455 posts
    Member since:
    Sep 2012

    Posted 08 Nov 2012 Link to this post

    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.

Back to Top