Click here to Skip to main content
15,924,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Example: Style tag: which has properties like font, color, display… etc? which accept objects and its value.

Can anyone add a complete input about how to create Parent Property with multiple child properties or in short nested properties.

Eg:
<Uc:Control Id="UControl1&quot" Rainbow="Red:true;Blue=false;Green:true;" />;

As soon as Rainbow property is typed, it will get a list of number of colors. He can select list of those colors and assign a value to them.
Posted
Updated 30-Jul-10 2:50am
v2
Comments
raju melveetilpurayil 30-Jul-10 8:52am    
Edited for better Readability

1 solution

Property is something like attribute.....
a property can be reference type or value type...
reference type = any class like "String","DateTime","SqlConnection"..
what we use "new" keyword to initialize....
and
value type = any type like..."string","int","float","double"........
now if you want a Parent Property and Child Properties......
Use this....
first making the reference type ......
public class RainbowClass
{
    bool red,blue,green;
    public RainbowClass()
    {
       red=false;
       blue=false;
       green=false;
    }
    
    public bool Red
    {
       get
       {
         return red;
       }
       set
       {
         red=value;
       }
    }
    public bool Blue
    {
       get
       {
         return blue;
       }
       set
       {
         blue=value;
       }
    }
    public bool Green
    {
       get
       {
         return green;
       }
       set
       {
         green=value;
       }
    }

}// end of you sub class type....

now in your user control....make a property like this...
RainbowClass rainbowObject;//global variable of your user control

public RainbowClass Rainbow
{
    get
    {
      return rainbowObject;
    }
    set
    {
      rainbowObject=value;
    }
}


may be i misunderstood your question and i may have posted irrelevant answer.... plz dont mind if it is like that
 
Share this answer
 
v2
Comments
kapil0411 31-Jul-10 2:09am    
Hi,Kabeer
Thanks for your quick response.
Actually when user types rainbow class property in the user control tag in aspx page, we should get intellisense of nested property (Child property) i.e we will get nested property like color red,blue,green and we can select value true or false accordingly.

Similarly to style tag work.i.e style="color:Red;Width:100%;".


Awaiting for your reply.
koool.kabeer 31-Jul-10 14:00pm    
hi kapil...
you are somewhat like TypeConverters.....
you can get the solution here on this link

http://www.csharphelp.com/2007/07/c-type-converters-your-friendly-helpers/

that was really a nice question kapil.....i have got really nice things from that article..... thanks for your question
koool.kabeer 31-Jul-10 14:01pm    
well i am just doing my work on it hope if you know something.. you will share here that thing.... and sorry for my irrelevant answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900