CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 9/6/2004 10:32:18 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 31 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
Tom_
Asp.Net User
Control designer vs. tree structure of child controls9/6/2004 10:32:18 AM

0/0

Hi,

I have context menu that has tree of childen context menu items.
When I edit first level children all is OK, when I try to add 2nd level children using designer (default collection editor), I'm able to add items but when I clik OK I get messageBox message...object reference not set to instance object...but this children are succesfully persisted into page code.

Many thanks for all advices

here is a lightweight sample:
//CONTEXT MENU
[ ToolboxData("<{0}:ContextMenu runat=server></{0}:ContextMenu>"),
ControlBuilder(typeof(ContextMenuControlBuilder)),
ParseChildren(true, "MenuItems") ]
public class ContextMenu : System.Web.UI.WebControls.WebControl, INamingContainer
{
private ContextMenuItemCollection m_cMenuItems;
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public ContextMenuItemCollection MenuItems { get{return m_cMenuItems;} }
public ContextMenu():base(){ m_cMenuItems= new ContextMenuItemCollection(); }
protected override void Render(HtmlTextWriter output){ output.Write("foo"); }
}

//CONTEXT MENU ITEM
[ ToolboxData("<{0}:ContextMenuItem runat=server></{0}:ContextMenuItem>"),
ControlBuilder(typeof(ContextMenuControlBuilder)),
ParseChildren(true, "MenuItems") ]
public class ContextMenuItem : System.Web.UI.WebControls.WebControl, INamingContainer
{
private ContextMenuItemCollection m_cMenuItems;
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public ContextMenuItemCollection MenuItems { get{return m_cMenuItems;} }
public ContextMenuItem():base(){ m_cMenuItems= new ContextMenuItemCollection(); }

protected override void Render(HtmlTextWriter output){ output.Write("foo"); }
}

//CONTEXT MENU ITEM COLLECTION
public class ContextMenuItemCollection: CollectionBase
{
public ContextMenuItem this[int iIndex]{ get{return (ContextMenuItem) List[iIndex] ;} set{List[iIndex]= value;}}
public void Add(ContextMenuItem oMenuItem){ this.Add(oMenuItem); }
}
//CONTROL BUILDER FOR CONTEXTMENU, MENU ITEM

public class ContextMenuControlBuilder: ControlBuilder
{
public override Type GetChildControlType(string sTagName, IDictionary attribs)
{
if(sTagName.ToLower().EndsWith("contextmenuitem")) return typeof(ContextMenuItem);
return null;
}
}
master4eva
Asp.Net User
Re: Control designer vs. tree structure of child controls9/7/2004 7:05:04 AM

0/0

I just blogged the answer. You can view the blog post here:

http://blogs.aspadvice.com/jlovell/archive/2004/09/07/1619.aspx
-- Justin Lovell
Tom_
Asp.Net User
Re: Control designer vs. tree structure of child controls9/7/2004 9:12:15 AM

0/0

Many thanks Justin, good article...

thanks for giving the 'dirty MS' game away ;-)
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Expert ASP.NET 2.0 Advanced Application Design: Advanced Application Design Authors: Dominic Selly, Andrew Troelsen, Tom Barnaby, Pages: 459, Published: 2005
Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Step by Step: Version 2003 Authors: G. Andrew Duthie, Pages: 624, Published: 2003
Pro .NET 2.0 Windows Forms and Custom Controls in C#: From Professional to Expert Authors: Matthew MacDonald, Pages: 1037, Published: 2005
Microsoft ASP.NET Programming with Microsoft Visual C# .NET Step by Step: Version 2003 Authors: G. Andrew Duthie, Pages: 624, Published: 2003
Information Security: 5th International Conference, ISC 2002, Sao Paulo, Brazil, September 30-October 2, 2002 : Proceedings Authors: Agnes Hui Chan, Virgil D. Gligor, Pages: 502, Published: 2002
The Craft of Information Visualization: Readings and Reflections Authors: Benjamin B. Bederson, Ben Shneiderman, Pages: 410, Published: 2003
ASP.NET 2.0 All-In-One Desk Reference For Dummies: all-in-one desk reference for dummies Authors: Doug Lowe, Jeff Cogswell, Ken Cox, Pages: 910, Published: 2006
Professional InfoPath 2003 Authors: Ian Williams, Pierre Greborio, Pages: 408, Published: 2004

Web:
Microsoft SharePoint Designer Team Blog : Best Practice to create ... Oct 3, 2008 ... Control tree structure might be different. Many times controls are added to designer Tree structure in a “flatted out” way, instead of the ...
Controls demystified - presentation to the ADUG - March 1998 Child controls can be any control type, not only graphic controls, but also other windowed controls. This recursive relationship leads to a tree structure ...
CodeProject: DateTimePicker Web Control. Free source code and ... If we give our own IDs to the child controls, then we won't be able to ... Thus we see that the naming scheme and control tree structure is central to event ...
A Crash Course on ASP.NET Control Development: Building Composite ... Building a complex control tree comes easier, and the final result is neater and more elegant, if you use child controls. Additionally, you have to deal ...
Tree Control : The Official Microsoft ASP.NET Site NET server control with AJAX support to display hierarchical data in a tree structure. The main advantage over other TreeView controls is the SIMPLICITY. ...
Problem with enumerating all the child controls - VBForums Private Sub MakeControlList() Dim controls As List(Of Control) controls = New ... You may want to consider a different structure such as a tree if you want ...
Tree: Implementing a Non-Binary Tree in C# « Critical Development Mar 15, 2008 ... The control is the common TreeView, which supplies a way in this case for users to explore and interact with the tree data structure of the ...
CodeProject: A Graph Tree Drawing Control for WPF. Free source ... Sep 20, 2008 ... When I first tried to create the tree control programattically, .... and one that use controls (as in the WPF Diagram Designer article). ...
Creating Usable Page Templates in ASP.NET If you fail to add the server controls to the control tree properly (by .... NET runtime places the child controls contained within its calling tags ...
Control Development A good practice is to always clear any existing child control when entering. CreateChildControls to ensure it runs with a blank control tree. Controls. ...

Videos:
KIYAMET - X Bilinmeyen ( Doomsday X - The Unknown ) Açıklama: Bu belgesel filmde inşaallah, Kur'an-ı Kerim ve Hadis-i Şerifler ışığında Kıyamet'in nasıl vuku bulacağı ve içinde bulunduğumuz ahir zaman ...
Hidabroot אסטרולגיה Astrologia astrology עוד לפני אלפי שנים עסקו אנשי העולם העתיק בחקר Astrologia מידע הטמון בקרבי השמים אודות גורלו של האדם ואופיו. האיצטגנינות או בשמה המודרני אסטרולוגיה ה...
can - oh yeh can video for oh yeh




Search This Site:










getusersinrole

membership and profiles are creating 2 different users.

bug with switching tab skin to <not specified>

row and column level authorization

blocking site access

autopostback on dropdownlist error

error: column 'text' does not belong to table

dnn 2.0.3 unhandled exception

using xhtml labels for forms with asp.net

is it free?!?!?!?!

datetime.now

'asp' is an unrecognized tag prefix?

sitemap url...

moving controls etc around the screen without using tables in visual web developer design mode like visual studio

applying skins to the control templates???

users not able to post in forum module 3.10.01 on fresh dnn 3.1.0

want the aspnet.mdf tables in my main database

formsauthentication cookie not getting set question

help! build error on file not in project

is there a dropdowncheckboxlist control?

werbparts and firebird database!

memory consumption

after selecting a theme i receive invalid postback or callback argument.......

mail sending problem

scheduler doesn't work on dnn 3.1

enterprise library 3.1 for dotnet 2.0

installation problem

visual web developer is utterly useless.

best source control application

problem with sending mails - the from field

 
All Times Are GMT