Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TypeConverter for object reference assignment
Message
From
04/05/2012 00:29:12
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
TypeConverter for object reference assignment
Environment versions
Environment:
C# 3.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01543165
Message ID:
01543165
Views:
60
Hi
I have write a simple webcontrol, which contains properties as below
public class MyClass : WebControl
{
    public Button myButton { get { } set { } }
}
I would like to add design-time support for this control to ease my developer. Once myClass is dropped on web form, I want developer to able to go to property designer, navigate to "myButton" property row, click the drop down and select one of the button exist in current web form.

As now, the aspx code generated is
<cc1: myClass ID="xxx" runat="server" myButton = "OneOfmyButton1"/>
When run the app, I will hit error. I would like to ask for sample how to generate code in designer.cs so that I can have
this.xxx.myButton = this.OneOfmyButton1;
I search from web, but only found expandableObject, InstanceDescriptor ... which I am not sure it is useful for my case.

Please advice. thank you
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Reply
Map
View

Click here to load this message in the networking platform