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


C# WebPartManager.GetProviderConnectionPoints方法代码示例

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


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

示例1: RenderMenuPopup


//.........这里部分代码省略.........
                                "', '" +
                                Util.QuoteJScriptString(eventArgument) +
                                "');";

                            _menuUser.Page.ClientScript.RegisterForEventValidation(target, eventArgument);
                        }

                        string clientClickScript = null;
                        if (!String.IsNullOrEmpty(verb.ClientClickHandler)) {
                            clientClickScript = "document.body.__wpm.Execute('" +
                                Util.QuoteJScriptString(Util.EnsureEndWithSemiColon(verb.ClientClickHandler)) +
                                "')";
                        }

                        // There must be either an EventArgument or a ClientClickHandler
                        Debug.Assert(submitScript != null || clientClickScript != null);

                        string onclick = String.Empty;
                        if (submitScript != null && clientClickScript != null) {
                            onclick = "if(" + clientClickScript + "){" + submitScript + "}";
                        }
                        else if (submitScript != null) {
                            onclick = submitScript;
                        }
                        else if (clientClickScript != null) {
                            onclick = clientClickScript;
                        }

                        if (verb is WebPartCloseVerb) {
                            Debug.Assert(associatedWebPart != null);

                            // PERF: First check if this WebPart even has provider connection points
                            ProviderConnectionPointCollection connectionPoints =
                                webPartManager.GetProviderConnectionPoints(associatedWebPart);
                            if (connectionPoints != null && connectionPoints.Count > 0 &&
                                webPartManager.Connections.ContainsProvider(associatedWebPart)) {
                                onclick = "if(document.body.__wpmCloseProviderWarning.length == 0 || " +
                                    "confirm(document.body.__wpmCloseProviderWarning)){" + onclick + "}";
                            }
                        }
                        else if (verb is WebPartDeleteVerb) {
                            onclick = "if(document.body.__wpmDeleteWarning.length == 0 || " +
                                "confirm(document.body.__wpmDeleteWarning)){" + onclick + "}";
                        }
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclick);
                    }
                }

                string disabledClass = "menuItem";
                if (!verb.Enabled) {
                    if (associatedWebPart.Zone.RenderingCompatibility < VersionUtil.Framework40) {
                        writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
                    }
                    else if (!String.IsNullOrEmpty(WebControl.DisabledCssClass)) {
                        disabledClass = WebControl.DisabledCssClass + " " + disabledClass;
                    }
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Class, disabledClass);
                writer.RenderBeginTag(HtmlTextWriterTag.A);

                string img = verb.ImageUrl;
                if (img.Length != 0) {
                    img = _menuUser.UrlResolver.ResolveClientUrl(img);
                }
                else {
                    if (verb.Checked) {
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:67,代码来源:WebPartMenu.cs

示例2: RenderMenuPopup

 private void RenderMenuPopup(HtmlTextWriter writer, ICollection verbs, string clientID, WebPart associatedWebPart, WebPartManager webPartManager)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, clientID + "Menu");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     bool isEmpty = true;
     WebPartMenuStyle menuPopupStyle = this._menuUser.MenuPopupStyle;
     if (menuPopupStyle != null)
     {
         menuPopupStyle.AddAttributesToRender(writer, this._menuUser as WebControl);
         isEmpty = menuPopupStyle.Width.IsEmpty;
     }
     else
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
         writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
         writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
     }
     if (isEmpty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     bool isEnabled = associatedWebPart.Zone.IsEnabled;
     foreach (WebPartVerb verb in verbs)
     {
         string description;
         writer.RenderBeginTag(HtmlTextWriterTag.Div);
         if (associatedWebPart != null)
         {
             description = string.Format(CultureInfo.CurrentCulture, verb.Description, new object[] { associatedWebPart.DisplayTitle });
         }
         else
         {
             description = verb.Description;
         }
         if (description.Length != 0)
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Title, description);
         }
         bool flag3 = isEnabled && verb.Enabled;
         if (verb is WebPartHelpVerb)
         {
             string str2 = associatedWebPart.ResolveClientUrl(associatedWebPart.HelpUrl);
             writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
             if (flag3)
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "document.body.__wpm.ShowHelp('" + Util.QuoteJScriptString(str2) + "', " + ((int) associatedWebPart.HelpMode).ToString(CultureInfo.InvariantCulture) + ")");
             }
         }
         else if (verb is WebPartExportVerb)
         {
             string exportUrl = webPartManager.GetExportUrl(associatedWebPart);
             writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
             if (flag3)
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "document.body.__wpm.ExportWebPart('" + Util.QuoteJScriptString(exportUrl) + ((associatedWebPart.ExportMode == WebPartExportMode.All) ? "', true, false)" : "', false, false)"));
             }
         }
         else
         {
             string postBackTarget = this._menuUser.PostBackTarget;
             writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
             if (flag3)
             {
                 string eventArgument = verb.EventArgument;
                 if (associatedWebPart != null)
                 {
                     eventArgument = verb.GetEventArgument(associatedWebPart.ID);
                 }
                 string str6 = null;
                 if (!string.IsNullOrEmpty(eventArgument))
                 {
                     str6 = "document.body.__wpm.SubmitPage('" + Util.QuoteJScriptString(postBackTarget) + "', '" + Util.QuoteJScriptString(eventArgument) + "');";
                     this._menuUser.Page.ClientScript.RegisterForEventValidation(postBackTarget, eventArgument);
                 }
                 string str7 = null;
                 if (!string.IsNullOrEmpty(verb.ClientClickHandler))
                 {
                     str7 = "document.body.__wpm.Execute('" + Util.QuoteJScriptString(Util.EnsureEndWithSemiColon(verb.ClientClickHandler)) + "')";
                 }
                 string str8 = string.Empty;
                 if ((str6 != null) && (str7 != null))
                 {
                     str8 = "if(" + str7 + "){" + str6 + "}";
                 }
                 else if (str6 != null)
                 {
                     str8 = str6;
                 }
                 else if (str7 != null)
                 {
                     str8 = str7;
                 }
                 if (verb is WebPartCloseVerb)
                 {
                     ProviderConnectionPointCollection providerConnectionPoints = webPartManager.GetProviderConnectionPoints(associatedWebPart);
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:WebPartMenu.cs


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