New Posts New Posts RSS Feed: How do I enable/disable Search/GridViews
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

How do I enable/disable Search/GridViews

 Post Reply Post Reply
Author
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Topic: How do I enable/disable Search/GridViews
    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>();

        }

Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post 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.

 
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 10-Oct-2007 at 12:55pm
Fine if that provides the functionality you want.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down