【问题标题】:SharePoint 2010: Create "Alert Me" buttonSharePoint 2010:创建“提醒我”按钮
【发布时间】:2011-07-03 17:12:27
【问题描述】:

希望这是一个简单的...

我需要在我的自定义 SharePoint 母版页上创建一个“提醒我”按钮,单击该按钮后,会将用户引导至该特定网站/列表的预填充“新提醒”页面。 OOTB 博客网站模板已经在 default.aspx 页面底部提供了这个完全相同的按钮,它的标记如下:

http://server/currentsite/_layouts/SubNew.aspx?List={00000000-0000-0000-0000-000000000000}&Source=http://server/currentsite/default.aspx

有谁知道是否有一个 OOTB 控件或 Web 部件,我可以直接放入我的页面布局中来重现这个吗?

显然,如果需要,我可以在页面布局的代码隐藏中动态创建按钮,但如果还没有预先编写的控件,我会感到惊讶。

提前谢谢...

【问题讨论】:

    标签: sharepoint-2010 alerts


    【解决方案1】:

    对于那些感兴趣的人,我最终为此滚动了自己的用户控件。代码如下:

    HTML


    <asp:HyperLink ID="AlertHyperLink" runat="server"><img alt="Alert me" src="/_layouts/images/menualert.gif" title="Alert me to any changes that get made to this site." /></asp:HyperLink>
    

    C#


    protected void Page_PreRender(object sender, EventArgs e)
    {
        // If the current page is not associated with a list, then hide the list-sensitive tools.
        if (SPContext.Current.List != null)
        {
            this.AlertHyperLink.NavigateUrl = string.Format(
                "{0}/_layouts/SubNew.aspx?List={{{1}}}&Source={2}",
                SPContext.Current.Web.Url,
                SPContext.Current.List.ID.ToString(),
                this.Server.UrlEncode(this.Page.Request.Url.ToString()));
        }
        else
        {
            this.AlertHyperLink.Visible = false;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-14
      相关资源
      最近更新 更多