in
Forums
Blogs
DevExpress.com
Client Center
Support Center
DevExpress Channel

Paul Kimmel's Blog

How Do You Add Update and Cancel Buttons to an ASPxTreeList template (or EditForm)

Did you know that the ASPxTreeList has an editor form mode? Many of you probably did. Like the ASPxGridView this means you can edit a node in the tree list using a form for making changes to the data rather than plain old TextBoxes, in edit form mode you get controls that are generally more type friendly and an input layout that is a little more intuitive.

Did you know that the ASPxTreeList lets you define custom templates? It does. While the ASPxTreeList is pretty good at figuring out how to design and edit form and the column properties and style properties will let you manage the appearance of the ASPxTreeList in a lot of ways, you can define your own edit form. To do so click the Smart tags menu, click Edit templates, choose the EditForm template and design away.

But wait, how do you implement the equivalent of the Update and Cancel command? Ah! the easy answer is the ASPxTreeListTemplateReplacement . (That’s a mouthful. working on the book I wrote that about ten times.) Unfortunately, the ASpxTreeListTemplateReplacement control is not in the toolbox by default. You have to add it. The easy way to get the Update and Cancel commands in your ASPxTreeList template is to:

  1. Open the Toolbox in Visual Studio
  2. Expand the Developer Express Data tab
  3. Right-click to display the Toolbox context menu and click Choose Items
  4. On the .NET tab of the Choose Toolbox Items dialog scroll down until you see the ASPxTreeListTemplateReplacement control
  5. Check the box next to it and close the dialog

Once you have the ASPxTreeListTemplateReplacement control in the Toolbox use this control to create the Update and Cancel buttons as needed for ASPxTreeList templates. To configure the update button change the ASPxTreeListTemplateReplacement.ReplacementType to UpdateButton, and to configure the Cancel button change the other ASPxTreeListTemplateReplacement.ReplacementType to CancelButton. That’s all you need to do. With these controls no code is needed to invoke the update and cancel behaviors for the ASPxTreeList in edit mode.

Published May 19 2009, 03:00 PM by Paul Kimmel (Developer Express)

Comments

 

CESAR F. QüEB said:

Hi PaulK,

Nice tip.. but..and the pictures and code?...sometimes an image and code says more that a great a clear article. :)

Thank you in advance...

ahhh... I'm waiting your ebook with anxiety.

May 19, 2009 12:06 PM
 

Paul Kimmel (Developer Express) said:

Cesar:

Thank you. The book will actually be a real, bound, paper and glue book in your local bookstore or available for purchase online. You can actually purcashe advance copies now.

May 19, 2009 12:32 PM
 

Phill said:

How would you assign images to ASPxTreeListTemplateReplacement ?

October 26, 2009 4:58 AM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2010 Developer Express Inc.
ALL RIGHTS RESERVED