How can change the DataConverter?
Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=804
Printed Date: 10-May-2024 at 4:20pm
Topic: How can change the DataConverter?
Posted By: aladdin
Subject: How can change the DataConverter?
Date Posted: 12-May-2008 at 7:51pm
Hello,
the GridBuilder method add columns for every custom GridView we want to create,
if want to add read only columns use DataConverter.ReadOnlyField ,
in my case want to add read only columns when the entity has children
how to do this ?
The View and the presenter is same for all entities, only GridBuilder is uniq, the bindingsource fill after the GridBuilder...
|
Replies:
Posted By: aladdin
Date Posted: 10-Jun-2008 at 12:21am
i think is right
public class CustomerGridBuilder : DevExGridBuilderBase {
/// <summary>Recipe for building the Grid.</summary> protected override void BuildCore() { StyleGridToStandard(); EntityPropertyDescriptors.CustomerPropertyDescriptor descriptors = EntityPropertyDescriptors.Customer; AddColumnReadOnly(descriptors.Id, "Id");
IEntityEditorController editor = EditorService.GetEditor(WorkItem.ID); list = ((Customer)editor.RootEntity).Orders; list.ListChanged += new System.ComponentModel.ListChangedEventHandler(list_ListChanged); cbd = AddColumn(descriptors.ContactName, "Name"); if (list.Count > 0) cbd.DataConverter = IdeaBlade.UI.TextConverter.ReadOnlyField; else cbd.DataConverter = IdeaBlade.UI.TextConverter.OptionalField; }
void list_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemAdded || e.ListChangedType == System.ComponentModel.ListChangedType.ItemDeleted) {
if (list.Count > 0) cbd.DataConverter = IdeaBlade.UI.TextConverter.ReadOnlyField; else cbd.DataConverter = IdeaBlade.UI.TextConverter.OptionalField; } } /// <summary>Get the grid column widths.</summary> protected IEntityEditorService EditorService { get { if (mEditorService == null) { mEditorService = WorkItem.Services.Get<IEntityEditorService>(); } return mEditorService; } }
private ControlBindingDescriptor cbd; private ReadOnlyEntityList<SizesPalletLn> list; private IEntityEditorService mEditorService;
|
|