背景:
阅读新闻

SharePoint custom SaveButton

  作者: 今日评论: [字体: ]

    public class MySaveButton : SaveButton

    {

        protected override void OnInit(EventArgs e)

        {

            base.OnInit(e);

            this.Text = "XXX添加XXX";

        }

        protected override bool SaveItem()

        {

            //custom code

            ItemContext.ListItem.Fields["SaveStatus"].ValidateParseAndSetValue(SPContext.Current.ListItem, "save");


            //ASP._controltemplates_15_productadd_ascx

            TextBox txtGetValueFromSavaButtonClass =(TextBox)this.TemplateControl.FindControl("txtGetValueFromSavaButtonClass");


            bool result = base.SaveItem();

            return result;

        }


        //C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\TEMPLATE\CONTROLTEMPLATES

        protected override string DefaultTemplateName

        {

            get

            {

                return "MySaveButton";

                //検索条件  "RenderingTemplate ID=\"SaveButton"

                //C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx(1874, 13)

                //[UTF - 8]: < SharePoint:RenderingTemplate ID = "SaveButton" runat = "server" >

            }

        }


        //protected override bool OnBubbleEvent(object source, EventArgs e)

        //{

        //    ItemContext.ListItem.Fields["Product Description"].ValidationMessage = "asd";

        //    return base.OnBubbleEvent(source, e);

        //}

    }


<SharePoint:RenderingTemplate ID="MySaveButton" runat="server">

    <Template>

        <asp:Button UseSubmitBehavior="false" ID="diidIOSaveItem" CommandName="SaveItem" Text="<%$Resources:wss,tb_save%>"

            class="ms-ButtonHeightWidth" AccessKey="<%$Resources:wss,tb_save_AK%>" target="_self" runat="server" />

    </Template>

</SharePoint:RenderingTemplate>


来源:
录入日期:[2017/12/14 1:13:00]
收藏 推荐 打印 | 录入:mikebai | 阅读:
文章评论      
正在加载评论列表...
评论表单加载中...