本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
示例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;
}