当前位置: 首页>>代码示例>>C#>>正文


C# WebPart.SetWebPartManager方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.WebParts.WebPart.SetWebPartManager方法的典型用法代码示例。如果您正苦于以下问题:C# WebPart.SetWebPartManager方法的具体用法?C# WebPart.SetWebPartManager怎么用?C# WebPart.SetWebPartManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.WebParts.WebPart的用法示例。


在下文中一共展示了WebPart.SetWebPartManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveWebPart

 internal void RemoveWebPart(WebPart webPart)
 {
     string errorMsg = base.SetCollectionReadOnly(null);
     try
     {
         try
         {
             this._manager._partAndChildControlIDs.Remove(webPart.ID);
             GenericWebPart part = webPart as GenericWebPart;
             if (part != null)
             {
                 this._manager._partAndChildControlIDs.Remove(part.ChildControl.ID);
             }
             this.Remove(webPart);
             this._manager._hasDataChanged = true;
             webPart.SetWebPartManager(null);
             this._manager.Internals.SetIsStandalone(webPart, true);
             this._manager._partsForZone = null;
         }
         finally
         {
             base.SetCollectionReadOnly(errorMsg);
         }
     }
     catch
     {
         throw;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:WebPartManager.cs

示例2: RemoveWebPart

            internal void RemoveWebPart(WebPart webPart) {
                string originalError = SetCollectionReadOnly(null);
                // Extra try-catch block to prevent elevation of privilege attack via exception filter
                try {
                    try {
                        _manager._partAndChildControlIDs.Remove(webPart.ID);

                        // Remove child control ID (VSWhidbey 339482)
                        GenericWebPart genericWebPart = webPart as GenericWebPart;
                        if (genericWebPart != null) {
                            _manager._partAndChildControlIDs.Remove(genericWebPart.ChildControl.ID);
                        }

                        Remove(webPart);
                        _manager._hasDataChanged = true;
                        webPart.SetWebPartManager(null);
                        _manager.Internals.SetIsStandalone(webPart, true);

                        // Invalidate the part dictionary if it has already been created
                        _manager._partsForZone = null;
                    }
                    finally {
                        SetCollectionReadOnly(originalError);
                    }
                }
                catch {
                    throw;
                }
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:WebPartManager.cs

示例3: AddWebPartHelper

 private void AddWebPartHelper(WebPart webPart)
 {
     string iD = webPart.ID;
     if (string.IsNullOrEmpty(iD))
     {
         throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_NoWebPartID"));
     }
     if (this._manager._partAndChildControlIDs.Contains(iD))
     {
         throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_DuplicateWebPartID", new object[] { iD }));
     }
     this._manager._partAndChildControlIDs.Add(iD, null);
     GenericWebPart part = webPart as GenericWebPart;
     if (part != null)
     {
         string str2 = part.ChildControl.ID;
         if (string.IsNullOrEmpty(str2))
         {
             throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_NoChildControlID"));
         }
         if (this._manager._partAndChildControlIDs.Contains(str2))
         {
             throw new InvalidOperationException(System.Web.SR.GetString("WebPartManager_DuplicateWebPartID", new object[] { str2 }));
         }
         this._manager._partAndChildControlIDs.Add(str2, null);
     }
     this._manager.Internals.SetIsStandalone(webPart, false);
     webPart.SetWebPartManager(this._manager);
     this.Add(webPart);
     this._manager._partsForZone = null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:WebPartManager.cs

示例4: AddWebPartHelper

            private void AddWebPartHelper(WebPart webPart) {
                string partID = webPart.ID;
                if (String.IsNullOrEmpty(partID)) {
                    throw new InvalidOperationException(SR.GetString(SR.WebPartManager_NoWebPartID));
                }
                if (_manager._partAndChildControlIDs.Contains(partID)) {
                   throw new InvalidOperationException(SR.GetString(SR.WebPartManager_DuplicateWebPartID, partID));
                }

                // Add to dictionary to prevent duplicate IDs, even if this part is not authorized.  Don't want page
                // developer to have 2 parts with the same ID, and not get the exception until they are both authorized.
                _manager._partAndChildControlIDs.Add(partID, null);

                // Check and add child control ID (VSWhidbey 339482)
                GenericWebPart genericWebPart = webPart as GenericWebPart;
                if (genericWebPart != null) {
                    string childControlID = genericWebPart.ChildControl.ID;

                    if (String.IsNullOrEmpty(childControlID)) {
                        throw new InvalidOperationException(SR.GetString(SR.WebPartManager_NoChildControlID));
                    }

                    if (_manager._partAndChildControlIDs.Contains(childControlID)) {
                        throw new InvalidOperationException(SR.GetString(SR.WebPartManager_DuplicateWebPartID, childControlID));
                    }

                    _manager._partAndChildControlIDs.Add(childControlID, null);
                }

                _manager.Internals.SetIsStandalone(webPart, false);
                webPart.SetWebPartManager(_manager);
                Add(webPart);

                // Invalidate the part dictionary if it has already been created
                _manager._partsForZone = null;
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:36,代码来源:WebPartManager.cs


注:本文中的System.Web.UI.WebControls.WebParts.WebPart.SetWebPartManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。