zoukankan      html  css  js  c++  java
  • 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();
                    }
    
                }
    
            }
  • 相关阅读:
    2015.07.20MapReducer源码解析(笔记)
    Hive(笔记)
    HDFS入门(1)
    Zookepper(2015.08.16笔记)
    USB_ModeSwitch 介绍(转)
    Perl 模块 Getopt::Std 和 Getopt::Long
    在linux下设置开机自动启动程序的方法
    gcc Makefile 入门
    Linuxexec函数族及system函数
    signal(SIGHUP, SIG_IGN)的含义
  • 原文地址:https://www.cnblogs.com/914556495wxkj/p/3620607.html
Copyright © 2011-2022 走看看