本文整理汇总了C#中System.Web.UI.WebControls.WebParts.WebPart类的典型用法代码示例。如果您正苦于以下问题:C# WebPart类的具体用法?C# WebPart怎么用?C# WebPart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebPart类属于System.Web.UI.WebControls.WebParts命名空间,在下文中一共展示了WebPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPartContents
protected virtual new void RenderPartContents (System.Web.UI.HtmlTextWriter writer, WebPart webPart)
{
Contract.Requires (webPart != null);
Contract.Requires (this.Zone != null);
Contract.Requires (this.Zone.ErrorStyle != null);
Contract.Requires (writer != null);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.Web.UI.WebControls.WebParts.WebPartChrome.cs
示例2: RenderTitleBar
protected virtual void RenderTitleBar(HtmlTextWriter writer, WebPart webPart)
{
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
base.Zone.PartTitleStyle.AddAttributesToRender(writer, base.Zone);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.AddAttribute(HtmlTextWriterAttribute.Title, webPart.Description, true);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.WriteEncodedText(webPart.Title);
writer.RenderEndTag();
writer.RenderEndTag();
base.Zone.PartTitleStyle.AddAttributesToRender(writer, base.Zone);
writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, TextAlign.Right.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.Td);
if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode)
{
this.RenderVerbs(writer, webPart);
}
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
示例3: RenderWebPart
public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
{
if (webPart == null)
{
throw new ArgumentNullException("webPart");
}
base.Zone.PartChromeStyle.AddAttributesToRender(writer, base.Zone);
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part_chrome");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode || webPart.ChromeType != PartChromeType.None || !webPart.Hidden)
{
this.RenderTitleBar(writer, webPart);
}
base.Zone.PartStyle.AddAttributesToRender(writer, base.Zone);
if (webPart.Hidden && !base.WebPartManager.DisplayMode.ShowHiddenWebParts)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part_hidden");
}
else
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divzone_part");
}
writer.RenderBeginTag(HtmlTextWriterTag.Div);
this.RenderPartContents(writer, webPart);
writer.RenderEndTag();
writer.RenderEndTag();
}
示例4: RenderWebPart
public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
{
if (webPart == null)
{
throw new ArgumentNullException("webPart");
}
base.Zone.PartChromeStyle.AddAttributesToRender(writer, base.Zone);
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
if (webPart.Hidden && !base.WebPartManager.DisplayMode.ShowHiddenWebParts)
{
writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
}
writer.RenderBeginTag(HtmlTextWriterTag.Table);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode || webPart.ChromeType != PartChromeType.None)
{
this.RenderTitleBar(writer, webPart);
}
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
base.Zone.PartStyle.AddAttributesToRender(writer, base.Zone);
writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, base.Zone.PartChromePadding.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.Td);
this.RenderPartContents(writer, webPart);
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
示例5: GetWebPartDetails
/// <summary>
/// Gets the web part details.
/// </summary>
/// <param name="wp">The web part.</param>
/// <param name="manager">The web part manager.</param>
/// <returns></returns>
internal static string GetWebPartDetails(WebPart wp, SPLimitedWebPartManager manager)
{
if (wp.ExportMode == WebPartExportMode.None)
{
Logger.WriteWarning("Unable to export {0}", wp.Title);
return "";
}
StringBuilder sb = new StringBuilder();
XmlTextWriter xmlWriter = new XmlTextWriter(new StringWriter(sb));
xmlWriter.Formatting = Formatting.Indented;
manager.ExportWebPart(wp, xmlWriter);
xmlWriter.Flush();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(sb.ToString());
XmlElement elem = xmlDoc.DocumentElement;
if (xmlDoc.DocumentElement.Name == "webParts")
{
elem = (XmlElement)xmlDoc.DocumentElement.ChildNodes[0];
// We've found a v3 web part but the export method does not export what the zone ID is so we
// have to manually add that in. Unfortunately the Zone property is always null because we are
// using a SPLimitedWebPartManager so we have to use the helper method GetZoneID to set the zone ID.
XmlElement property = xmlDoc.CreateElement("property");
property.SetAttribute("name", "ZoneID");
property.SetAttribute("type", "string");
property.InnerText = manager.GetZoneID(wp);
elem.ChildNodes[1].ChildNodes[0].AppendChild(property);
}
return elem.OuterXml.Replace(" xmlns=\"\"", ""); // Just some minor cleanup to deal with erroneous namespace tags added due to the zoneID being added manually.
}
示例6: WebPartConnectionsEventArgs
public WebPartConnectionsEventArgs(WebPart provider, System.Web.UI.WebControls.WebParts.ProviderConnectionPoint providerConnectionPoint, WebPart consumer, System.Web.UI.WebControls.WebParts.ConsumerConnectionPoint consumerConnectionPoint)
{
this._provider = provider;
this._providerConnectionPoint = providerConnectionPoint;
this._consumer = consumer;
this._consumerConnectionPoint = consumerConnectionPoint;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:WebPartConnectionsEventArgs.cs
示例7: WebPartConnectionsEventArgs
public WebPartConnectionsEventArgs(WebPart provider, ProviderConnectionPoint providerConnectionPoint,
WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint) {
// Arguments may be null, when deleting a connection because a part is no longer on the page
_provider = provider;
_providerConnectionPoint = providerConnectionPoint;
_consumer = consumer;
_consumerConnectionPoint = consumerConnectionPoint;
}
示例8: ContainsProvider
internal bool ContainsProvider(WebPart provider) {
foreach (WebPartConnection connection in List) {
if (connection.Provider == provider) {
return true;
}
}
return false;
}
示例9: ConnectWebParts
public virtual new WebPartConnection ConnectWebParts (WebPart provider, ProviderConnectionPoint providerConnectionPoint, WebPart consumer, ConsumerConnectionPoint consumerConnectionPoint, WebPartTransformer transformer)
{
Contract.Requires (provider != null);
Contract.Requires (consumer != null);
Contract.Requires (providerConnectionPoint != null);
Contract.Requires (consumerConnectionPoint != null);
return default(WebPartConnection);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:9,代码来源:System.Web.UI.WebControls.WebParts.WebPartManager.cs
示例10: RenderWebPart
public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
{
var chromeType = this.Zone.GetEffectiveChromeType(webPart);
AddPortletSkinCss(writer, webPart, chromeType.ToString().ToLower());
writer.AddAttribute(HtmlTextWriterAttribute.Id, this.GetWebPartChromeClientID(webPart));
writer.RenderBeginTag(HtmlTextWriterTag.Div);
var currentDisplayMode = this.WebPartManager.DisplayMode;
if (currentDisplayMode == WebPartManager.EditDisplayMode || currentDisplayMode == WebPartManager.DesignDisplayMode)
{
RenderVerbs(writer, webPart);
}
if (chromeType == PartChromeType.TitleAndBorder || chromeType == PartChromeType.BorderOnly)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-pt-border ui-widget-content ui-corner-all");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
}
if ((chromeType == PartChromeType.TitleOnly) || (chromeType == PartChromeType.TitleAndBorder))
RenderTitleBar(writer, webPart);
if (chromeType == PartChromeType.TitleAndBorder || chromeType == PartChromeType.BorderOnly)
{
RenderPortletBodyBeginTag(writer);
}
else
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-pt-body-borderless");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
}
RenderPartContents(writer, webPart);
if (chromeType == PartChromeType.TitleAndBorder || chromeType == PartChromeType.BorderOnly)
{
RenderPortletBodyEndTag(writer);
}
else
{
writer.RenderEndTag(); // sn-pt-body-borderless
}
if (chromeType == PartChromeType.TitleAndBorder)
RenderChromeFooter(writer);
if (chromeType == PartChromeType.TitleAndBorder || chromeType == PartChromeType.BorderOnly)
writer.RenderEndTag(); // sn-pt-border
if (this.WebPartManager.DisplayMode == WebPartManager.DesignDisplayMode)
RenderMaskTag(writer);
writer.RenderEndTag();
}
示例11: GetWebPartDetailsMinimal
/// <summary>
/// Gets the web part details.
/// </summary>
/// <param name="wp">The web part.</param>
/// <param name="manager">The web part manager.</param>
internal static string GetWebPartDetailsMinimal(WebPart wp, SPLimitedWebPartManager manager)
{
XmlDocument xmlDoc = new XmlDocument();
XmlElement wpXml = xmlDoc.CreateElement("WebPart");
xmlDoc.AppendChild(wpXml);
wpXml.SetAttribute("id", wp.ID);
XmlElement prop = xmlDoc.CreateElement("Title");
prop.InnerText = wp.Title;
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("Description");
prop.InnerText = wp.Description;
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("DisplayTitle");
prop.InnerText = wp.DisplayTitle;
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("Hidden");
prop.InnerText = wp.Hidden.ToString();
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("IsClosed");
prop.InnerText = wp.IsClosed.ToString();
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("IsShared");
prop.InnerText = wp.IsShared.ToString();
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("IsStandalone");
prop.InnerText = wp.IsStandalone.ToString();
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("IsStatic");
prop.InnerText = wp.IsStatic.ToString();
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("Zone");
if (wp.Zone != null)
prop.InnerText = wp.Zone.ToString();
else
prop.InnerText = manager.GetZoneID(wp);
wpXml.AppendChild(prop);
prop = xmlDoc.CreateElement("ZoneIndex");
prop.InnerText = wp.ZoneIndex.ToString();
wpXml.AppendChild(prop);
return Utilities.GetFormattedXml(xmlDoc);
}
示例12: ValidateWebPart
protected void ValidateWebPart(WebPart webPart)
{
if (webPart == null)
{
throw new ArgumentNullException("webPart");
}
if (!this._webPartManager.WebParts.Contains(webPart))
{
throw new ArgumentException(System.Web.SR.GetString("UnknownWebPart"), "webPart");
}
}
示例13: ApplyPersonalizationState
protected internal virtual void ApplyPersonalizationState(WebPart webPart)
{
if (webPart == null)
{
throw new ArgumentNullException("webPart");
}
if (this.IsEnabled)
{
this.EnsurePersonalizationState();
this._personalizationState.ApplyWebPartPersonalization(webPart);
}
}
示例14: ProcessWebpartProperties
protected virtual void ProcessWebpartProperties(WebPart instance, WebPartDefinition definition)
{
if (definition.Width.HasValue)
instance.Width = new Unit(definition.Width.Value);
if (definition.Height.HasValue)
instance.Height = new Unit(definition.Height.Value);
if (!string.IsNullOrEmpty(definition.ChromeState))
instance.ChromeState = (PartChromeState)Enum.Parse(typeof(PartChromeState), definition.ChromeState);
if (!string.IsNullOrEmpty(definition.ChromeType))
{
var chromeType = WebPartChromeTypesConvertService.NormilizeValueToPartChromeTypes(definition.ChromeType);
instance.ChromeType = (PartChromeType)Enum.Parse(typeof(PartChromeType), chromeType);
}
if (!string.IsNullOrEmpty(definition.ImportErrorMessage))
instance.ImportErrorMessage = definition.ImportErrorMessage;
if (!string.IsNullOrEmpty(definition.Description))
instance.Description = definition.Description;
if (!string.IsNullOrEmpty(definition.TitleIconImageUrl))
instance.TitleIconImageUrl = definition.TitleIconImageUrl;
if (!string.IsNullOrEmpty(definition.TitleUrl))
{
var urlValue = definition.TitleUrl ?? string.Empty;
TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Original value: [{0}]",
urlValue);
urlValue = TokenReplacementService.ReplaceTokens(new TokenReplacementContext
{
Value = urlValue,
Context = CurrentHost.HostFile.Web
}).Value;
TraceService.VerboseFormat((int)LogEventId.ModelProvisionCoreCall, "Token replaced value: [{0}]", urlValue);
instance.TitleUrl = urlValue;
}
if (!string.IsNullOrEmpty(definition.ExportMode))
instance.ExportMode = (WebPartExportMode)Enum.Parse(typeof(WebPartExportMode), definition.ExportMode);
ProcessWebpartCustomProperties(instance, definition);
ProcessParameterBindings(instance, definition);
}
示例15: ProcessWebpartProperties
protected override void ProcessWebpartProperties(WebPart webpartInstance, WebPartDefinition definition)
{
base.ProcessWebpartProperties(webpartInstance, definition);
var typedWebpart = webpartInstance.WithAssertAndCast<RefinementScriptWebPart>("webpartInstance", value => value.RequireNotNull());
var typedModel = definition.WithAssertAndCast<RefinementScriptWebPartDefinition>("webpartModel", value => value.RequireNotNull());
if (!string.IsNullOrEmpty(typedModel.SelectedRefinementControlsJson))
typedWebpart.SelectedRefinementControlsJson = typedModel.SelectedRefinementControlsJson;
if (!string.IsNullOrEmpty(typedModel.EmptyMessage))
typedWebpart.EmptyMessage = typedModel.EmptyMessage;
}