Print Page | Close Window

How do I enable/disable Search/GridViews

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=481
Printed Date: 18-Oct-2025 at 5:04am


Topic: How do I enable/disable Search/GridViews
Posted By: orcities
Subject: How do I enable/disable Search/GridViews
Date Posted: 09-Oct-2007 at 9:33am
There are times in my application when I want to disable the Search Grid and search criteria control.
 
How would I go about doing this? Can I access these controls from another control on the same PageView?
 
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));

 

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>();

        }




Replies:
Posted By: Bill Jensen
Date Posted: 09-Oct-2007 at 11:03am
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.



Posted By: orcities
Date Posted: 09-Oct-2007 at 11:08am

GridViewContext as far as I know does not have an enable or disable. Do I need to add this function and override the BasicGrid and the presenter as well?



Posted By: orcities
Date Posted: 09-Oct-2007 at 11:49am

Instead of enabling or disabling a grid I ended up using the BeforeLeaveMasterRowHandlerCore to set AllowAction to true or false.

 


Posted By: Bill Jensen
Date Posted: 10-Oct-2007 at 12:55pm
Fine if that provides the functionality you want.



Print Page | Close Window