Click here to Skip to main content
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 21: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 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 162
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 6 Mar 2012
Copyright © CodeProject, 1999-2014
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