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


C# WebPartManager.GetExportUrl方法代码示例

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


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

示例1: 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 popupSpansFullExtent = true;
            WebPartMenuStyle menuStyle = _menuUser.MenuPopupStyle;
            if (menuStyle != null) {
                menuStyle.AddAttributesToRender(writer, _menuUser as WebControl);
                popupSpansFullExtent = menuStyle.Width.IsEmpty;
            }
            else {
                // generate attributes corresponding to defaults on WebPartMenuStyle
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
            }
            if (popupSpansFullExtent) {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            bool isParentEnabled = associatedWebPart.Zone.IsEnabled;
            foreach (WebPartVerb verb in verbs) {
                Debug.Assert(verb != null);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                string alt;
                if (associatedWebPart != null) {
                    alt = String.Format(CultureInfo.CurrentCulture, verb.Description, associatedWebPart.DisplayTitle);
                }
                else {
                    alt = verb.Description;
                }
                if (alt.Length != 0) {
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, alt);
                }
                bool isEnabled = isParentEnabled && verb.Enabled;

                // Special case help, export, etc.
                if (verb is WebPartHelpVerb) {
                    Debug.Assert(associatedWebPart != null);

                    string resolvedHelpUrl =
                        ((IUrlResolutionService)associatedWebPart).ResolveClientUrl(associatedWebPart.HelpUrl);

                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                    if (isEnabled) {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick,
                                            "document.body.__wpm.ShowHelp('" +
                                            Util.QuoteJScriptString(resolvedHelpUrl) +
                                            "', " +
                                            ((int)associatedWebPart.HelpMode).ToString(CultureInfo.InvariantCulture) + ")");
                    }
                }
                else if (verb is WebPartExportVerb) {
                    Debug.Assert(associatedWebPart != null);

                    string exportUrl = webPartManager.GetExportUrl(associatedWebPart);

                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                    if (isEnabled) {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick,
                                            "document.body.__wpm.ExportWebPart('" +
                                            Util.QuoteJScriptString(exportUrl) +
                                            ((associatedWebPart.ExportMode == WebPartExportMode.All) ?
                                                "', true, false)" :
                                                "', false, false)"));
                    }
                }
                else {
                    string target = _menuUser.PostBackTarget;
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:void(0)");
                    if (isEnabled) {
                        string eventArgument = verb.EventArgument;
                        if (associatedWebPart != null) {
                            eventArgument = verb.GetEventArgument(associatedWebPart.ID);
                        }

                        string submitScript = null;
                        if (!String.IsNullOrEmpty(eventArgument)) {
                            submitScript = "document.body.__wpm.SubmitPage('" +
                                Util.QuoteJScriptString(target) +
                                "', '" +
                                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)) +
                                "')";
                        }
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源: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.GetExportUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。