mikebai.com

  • Home
  • dev
  • DotNET
  • M365
  • 搞笑
  • 杂七杂八
  • FocusDict
個人BLOG
it developer
  1. Main page
  2. DotNET
  3. Main content

SharePoint custom SaveButton

2017-12-14 111hotness 0likes 0comments

    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>

Tag: Nothing
Last updated:2017-12-14

mikebai

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

COPYRIGHT © 2025 mikebai.com. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang