Print Page | Close Window

Add controls to ViewFactory

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=655
Printed Date: 11-Jun-2026 at 9:18am


Topic: Add controls to ViewFactory
Posted By: orcities
Subject: Add controls to ViewFactory
Date Posted: 14-Jan-2008 at 2:26pm
I have my own EditorControl that inherits from the standard editor control. The only difference is the layout of the editor. I do not have tabs but I do have two seperate placeholders to hold the controls.
 
The top view is an edit instance control and the bottom is a grid of all the existing entries. I have already created a tab controller that uses this view.
 
The problem I am running across is that the grid and the edit control are not displaying as I think they should. In the tab control I did the following to get the control to show:
 
override CreateView()

View =        ViewFactory.AddNew(LOC.CEMS.Interface.Constants.ViewNames.SummaryGridView, WorkItem, mSummaryGridIdNumber );

 
override ConfigureContextCore();
CreateGridViewContext();

pContext.GridViewId = GridViewId;

ViewFactory.AddNew(ViewNames.BasicGrid, WorkItem, GridViewId, typeof(ContactAddress));

 

CreateInstanceDetailViewContext();

pContext.SummaryViewId = SummaryViewId;

ViewFactory.AddNew(LOC.CEMS.Rolodex.Constants.ViewNames.AddressView, WorkItem, SummaryViewId);

 
 
So basically I am associated the control to the ID, GridViewId or SummaryViewId, and they are populating just fine. When I try that in the editor control I have created it doesn't work. I have to do the following to get it to work:
 
override AddNewMainView()

ViewFactory.AddNew(LOC.CEMS.Interface.Constants.ViewNames.SummaryGridView, WorkItem, WorkspaceNames.PageContentSmartPartPlaceholder);

 
different CreateView menthods

WorkItem.SmartParts.AddNew<TView>(LOC.CEMS.Interface.Constants.WorkspaceNames.InstanceDetailSmartPartPlaceholder);

ViewFactory.AddNew(ViewNames.BasicGrid, WorkItem, LOC.CEMS.Interface.Constants.WorkspaceNames.GridSmartPartPlaceholder, typeof(TEntity));

If I try going by Id like I did in the tab controller it doesn't work. Nothing shows up. What would be the reason I would have to go by the workspace name to get it to display. It should go by the Identifiable Id that I gave in the View itself like the tab controller does..



Replies:
Posted By: DeLight
Date Posted: 15-Jan-2008 at 12:43am
the main and only law in displaying views via SmartPartPlaceholders is "view with BuilderID='ID' will be shown only in the SPP with SmartPartName='ID'". and of course view and SPP must belong to one WorkItem. no other rules exist.
so try to check this ids via WorkItemVisualizer, somewhere they are not equal. pay attention that for example MasterDetailControllers assign IDs to views as MakeViewSpecificId(smth) because several MasterDetailControllers can exist in one workitem.

-------------



Print Page | Close Window