Click here to Skip to main content
11,632,715 members (85,315 online)
Rate this: bad
good
Please Sign up or sign in to vote.
I wanna create a server control like the following :
<%@ Register Assembly="MdsAccordionMenu" Namespace="MdsAccordionMenu" TagPrefix="cc1" %>
    <cc1:MdsAccordionMenu ID="MdsAccordionMenu1"  runat="server">
    	<MdsAccordionMenuItem Title="Some Title">
    		<MdsAccordionMenuItem Text="some text" Link="http://" IconUrl="image.png" />
    		<MdsAccordionMenuItem Text="some text" Link="http://" IconUrl="image.png" />
    		<MdsAccordionMenuItem Text="some text" Link="http://" IconUrl="image.png" />
    		<MdsAccordionMenuItem Text="some text" Link="http://" IconUrl="image.png" />
    	</MdsAccordionMenuItem>
    </cc1:MdsAccordionMenu> 
I written the following c# code , but it doesn't work :
MdsAccordionMenu.cs :
namespace MdsAccordionMenu
    {
    	[ToolboxData("<{0}:MdsAccordionMenu  runat="server"></{0}:MdsAccordionMenu>")]
    	[ParseChildren(true, "MdsAccordionMenuItems")]
    	[DefaultProperty("MdsAccordionMenuItems")]
    	[Serializable]
    	public class MdsAccordionMenu : WebControl
    	{
    		[Description("سرعت نمایش انیمیشن")]
    		[DefaultValue(500)]
    		public int AnimationSpeed { get; set; }
    
    		[Browsable(false), PersistenceMode(PersistenceMode.InnerProperty)]
    		public List<MdsAccordionMenuItem> MdsAccordionMenuItems { get; set; }
    	}
    }

MdsAccordionMenuItem.cs :
namespace MdsAccordionMenu
    {
    	//[TypeConverter(typeof(ExpandableObjectConverter))]
    	[ParseChildren(true, "MdsAccordionItems")]
    	[DefaultProperty("Title")]
    	[Serializable]
    	public class MdsAccordionMenuItem
    	{
    		[Description("تیتر منو")]
    		[DefaultValue("Title")]
    		[NotifyParentProperty(true)]
    		public string Title { get; set; }
    
    		[Browsable(false), PersistenceMode(PersistenceMode.InnerProperty)]
    		[NotifyParentProperty(true)]
    		public List<MdsAccordionItem> MdsAccordionItems { get; set; }
    	}
    }

MdsAccordionItem .cs:
namespace MdsAccordionMenu
    {
        [Serializable]
        public class MdsAccordionItem : INamingContainer
        {
            [NotifyParentProperty(true)]
            [Description("متن")]
            public string Text { get; set; }
    
            [NotifyParentProperty(true)]
            [Description("آدرس لینک منو")]
            public string Link { get; set; }
    
            [NotifyParentProperty(true)]
            [Description("آدرس آیکون")]
            public string ImageUrl { get; set; }
        }
    }

How can I do it?
Could you please guide me ?
Thanks
Posted 7-Feb-12 20:53pm
Comments
ryanb31 at 8-Feb-12 8:37am
   
What does "it doesn't work" mean?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 8,618
1 Sergey Alexandrovich Kryukov 8,189
2 Mika Wendelius 6,415
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 2,075


Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 6 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100