Originally posted by orcities
There are times in my application when I want to disable the Search Grid and search criteria control.
I assume you mean "dynamically disable" depending on the state of something.
How would I go about doing this? Can I access these controls from another control on the same PageView?
This kind of logic belongs in the controller for the page. The view context is the mechanism by which controllers and presenters communicate with each other.
Also, is it currently possible to enable/disable a GridView when it has been added to the ViewFactory similiarly to the following:
…
CreateGridViewContext();
pContext.GridViewId = GridViewId;
ViewFactory.AddNew(ViewNames.BasicGrid, WorkItem, GridViewId, typeof(ContactEmail));
…
Aside: The AddNew() doesn't add the view to the factory, it causes the factory to add a new instance of the view to the workitem.
private void CreateGridViewContext()
{
EntityBindingSource pContactEmailBindingSource
new EntityBindingSource(typeof(ContactEmail), EntityManager, mEmptyContactList, String.Empty);
GridViewContext context = GridViewContext.AddNew(WorkItem, GridViewId, pContactEmailBindingSource);
IGridBuilderService gridBuilderService = this.WorkItem.Services.Get<IGridBuilderService>();
context.GridBuilderPrototype = gridBuilderService.Get<ContactEmail>();
}
Again, let the page controller decide if the grid should be enabled or disabled and use the view context to allow it to communicate with the grid's presenter.
|