• sharepoint更新多行文本webparth


    前台

    <script>
      
        function Copy() {
            var value = document.getElementById("<%=BodyBox.ClientID %>").innerHTML;
            var real = value.replace(/<[^>]*>/g, "").replace(/&nbsp;/g, "").replace(/s+/g, "");
            if (real == "") {
                //alert("real is null");
                document.getElementById("<%=BodyBox2.ClientID %>").value = "";
            }
            else {
                //alert("real is not null: "+real)
                document.getElementById("<%=BodyBox2.ClientID %>").value = value;
            }
        }
    
    
    </script>
    
    
    
    <div runat="server" class="ms-rtestate-field ms-rtefield">
            <div id="BodyBox" runat="server" contenteditable="true"
                class="ms-rtestate-write ms-rteflags-0 ms-rtestate-field" role="textbox" aria-autocomplete="both"
                aria-haspopup="true" aria-multiline="true">
            </div>
    </div>
    
    <div><asp:Button ID="Button1" runat="server" Text="更新多行文本" OnClientClick="Copy()" OnClick="Button1_Click" /></div>
    
    <textarea id="BodyBox2" runat="server"></textarea>

    后台

        protected void Button1_Click(object sender, EventArgs e)
            {
    
                string value = BodyBox2.Value;
                genggai();
    
            }
            private void genggai()
            {
                SPListItem li = web.Lists["办理"].GetItemById(int.Parse(Page.Request["ID"]));//实例化要添加的列的值如果部署到别的列表里就更改test2这个列表名 
    
                SPListItemCollection listItems = web.Lists["办理"].Items;
                string value = BodyBox2.Value;
    
                foreach (SPListItem list in listItems)
                {
                    if (list["标题"].ToString() == li["标题"].ToString())
                    {
                        list["情况"] = value;
                        
                        list.Update();
                    }
    
                }
    
            }
  • 相关阅读:
    token
    id
    vim
    http_proxy
    brew
    认证
    go
    linux 磁盘管理
    vmware
    vmware fusion
  • 原文地址:https://www.cnblogs.com/914556495wxkj/p/3620607.html
Copyright © 2020-2023  润新知