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

RadGrid subclass cannot be added to Toolbox

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 12 Feb 2008, 02:34 PM
I'd like to subclass RadGrid prometheus in one of our assemblies so that the grid properties are set uniformly for each client developer like so:
namespace MP.Core.Controls
{
    public class MPViewGrid : Telerik.Web.UI.RadGrid
    {
        MPViewGrid()
        {
            FormatControls();
        }
        private void FormatControls()
        {
            this.AllowPaging = true;
            this.AllowSorting = true;
            this.GridLines = GridLines.Horizontal;
            this.ShowGroupPanel = true;
       }
    }
}
It compiles just fine, but I cannot get the derived grid, MPViewGrid, to show up in the developer's toolbox.  What should I do to make this happen?

Thank you,
Martin.


1 Answer, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 13 Feb 2008, 12:11 PM
hi


By default, the visual designer, of a tool such as Visual.Studio, creates an empty tag. This is a tag representing a control in its default state, when the control is dropped from the toolbox of a visual designer onto the design surface. To specify initial default values, a control can make use of this attribute. You can use this attribute to customize the initial HTML content that is placed in the designer when the control is dragged from the toolbox onto the form.

Here is an example:

using System;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
 
namespace CustomControls  
{  
 
  [ ToolboxData("<{0}:MyLabel Text='MyLabel' BorderColor='Yellow' BackColor='Magenta' BorderWidth = '10'  runat='server'></{0}:MyLabel>") ]      
  public class MyLabel : Label   
  {  
    public  MyLabel()  
    {   
      // Your code goes here.  
    }   
  }  
 
}  
 


Regards...
<John:Peel />
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Share this question
or