Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody,
Good Evening.

I'm making my control in that i have added an attribute.
I want that attribute similar to style attribute of web controls.

By similar I mean, I want an attribute with its sub-attributes.
eg:
<crt:mycontrol id="crt" newattribute="subattribute:value; subattribute2:true" xmlns:crt="#unknown"></crt:mycontrol>


So, by above example it will be clear to all that i want to add 'newattribute' in my control as style (style="width:30; height:50;") attribute.

Is it possible. If yes, then how? Please explain with examples...
Thanks in advance....
Posted
Updated 23-Oct-11 22:56pm
v3

1 solution

yes it is possible. In the code behind of the control declare a public property like,

C#
private string filename= string.Empty;

public string FileName
    {
        get
        {
            return this.filename;
        }

        set
        {
            this.filename = value;
        }
    }


And now you might use this property to your control like

C#
<crt:mycontrol id="crt" filename="MyTestFileName" xmlns:crt="#unknown">  </crt:mycontrol>
 
Share this answer
 
v2
Comments
Md. Rashim Uddin 26-Oct-11 3:16am    
Did u try with that or did u facing any problem??? if yes please let me know..
tanishtaman 28-Oct-11 8:35am    
hi, please see http://www.codeproject.com/Questions/272078/Controls-attribute-like-style-attribute link. its similar ques. Your result is not matched to my question.
Md. Rashim Uddin 28-Oct-11 9:26am    
yes i have seen this question. My answer is related to your question. You can add any properties like the way i have shown you..If you face any problem let me know,i will send you a small project including your answer.
tanishtaman 31-Oct-11 4:10am    
hi Rashim,

I need an property having multiple sub properties like < myctrl myproperty="subproperty1:value; subproperty2:value"> with intelligence help.

I'm sorry. I'm not getting your answer. Your answer only adds a property having value.i.e. < myctrl myproperty="value">. How to make a property having its sub property? If it can, Please provide me a small project.

Thanking you.
tanishtaman 3-Nov-11 0:13am    
hello Rashim,

Please reply. I'm waiting for your reply.

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