Setting custom control properties
I though it would be very simple but I can not get it today.
I have a user control, with a grid control contained in it.
public Unit Width
{
get
{
return CustomerGrid.Width;
}
set
{
CustomerGrid.Width = value;
}
}
I expose the width property and when I set it in the designer it works at run-time but not design time.
What class do I inherit from or method to override to get my controls to function at design time.
Note I tried to inherit from WebControl but got the message
Make sure that the class defined开发者_JS百科 in this code file matches the 'inherits' attribute, and that it extends the correct base class
I understand you're talking about user controls (ascx) and not about custom controls (no ascx). If this is the case, you should inherits from UserControl and you would have the property available on design time without any other addition.
In case you're talink about custom controls, here you have a good article about adding design time support to custom controls
http://msdn.microsoft.com/en-us/library/aa478960.aspx
精彩评论