예제 #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            _isAuthorizedToConfigure = CurrentPage.IsAuthorized("Administrate", CurrentPerson);

            Type containerType = Type.GetType(AttributeValue("ComponentContainer"));

            if (containerType != null)
            {
                PropertyInfo instanceProperty = containerType.GetProperty("Instance");
                if (instanceProperty != null)
                {
                    _container = instanceProperty.GetValue(null, null) as IContainerManaged;
                    if (_container != null)
                    {
                        if (!Page.IsPostBack)
                        {
                            _container.Refresh();
                        }

                        rGrid.DataKeyNames = new string[] { "id" };
                        if (_isAuthorizedToConfigure)
                        {
                            rGrid.GridReorder += rGrid_GridReorder;
                        }
                        rGrid.Columns[0].Visible = _isAuthorizedToConfigure;    // Reorder
                        rGrid.GridRebind        += rGrid_GridRebind;
                    }
                    else
                    {
                        DisplayError("Could not get ContainerManaged instance from Instance property");
                    }
                }
                else
                {
                    DisplayError("ContainerManaged class does not have an 'Instance' property");
                }
            }
            else
            {
                DisplayError("Could not get the type of the specified Manged Component Container");
            }
        }
예제 #2
0
        protected override void OnInit( EventArgs e )
        {
            base.OnInit( e );

            _isAuthorizedToConfigure = CurrentPage.IsAuthorized( "Administrate", CurrentPerson );

            Type containerType = Type.GetType( AttributeValue( "ComponentContainer" ) );
            if ( containerType != null )
            {
                PropertyInfo instanceProperty = containerType.GetProperty( "Instance" );
                if ( instanceProperty != null )
                {
                    _container = instanceProperty.GetValue( null, null ) as IContainerManaged;
                    if ( _container != null )
                    {
                        if ( !Page.IsPostBack )
                            _container.Refresh();

                        rGrid.DataKeyNames = new string[] { "id" };
                        if ( _isAuthorizedToConfigure )
                            rGrid.GridReorder += rGrid_GridReorder;
                        rGrid.Columns[0].Visible = _isAuthorizedToConfigure;    // Reorder
                        rGrid.GridRebind += rGrid_GridRebind;
                    }
                    else
                        DisplayError( "Could not get ContainerManaged instance from Instance property" );
                }
                else
                    DisplayError( "ContainerManaged class does not have an 'Instance' property" );
            }
            else
                DisplayError( "Could not get the type of the specified Manged Component Container" );
        }