• WEB PART


    using System;
    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Serialization;

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;

    namespace WebPart200
    {
        [Guid("0cabe99e-f555-4dce-91d3-26dbff58ed54")]
        public class HQWY_Add : System.Web.UI.WebControls.WebParts.WebPart
        {
            public HQWY_Add()
            {
            }
           
            TextBox txtUid = new TextBox();
            TextBox txtUname = new TextBox();
            protected override void CreateChildControls()
            {
                base.CreateChildControls();

                System.Web.UI.HtmlControls.HtmlTable table = new System.Web.UI.HtmlControls.HtmlTable();
               
                System.Web.UI.HtmlControls.HtmlTableRow tablerow1 = new System.Web.UI.HtmlControls.HtmlTableRow();
                System.Web.UI.HtmlControls.HtmlTableCell tablecell = new System.Web.UI.HtmlControls.HtmlTableCell();
                Label lable1 = new Label();
                lable1.Text="输入姓名:";
                tablecell.Controls.Add(lable1);

                System.Web.UI.HtmlControls.HtmlTableCell tablecell2 = new System.Web.UI.HtmlControls.HtmlTableCell();

                tablecell2.Controls.Add(txtUid);


                tablerow1.Controls.Add(tablecell);
                tablerow1.Controls.Add(tablecell2);
                table.Controls.Add(tablerow1);


                

                  tablerow1 = new System.Web.UI.HtmlControls.HtmlTableRow();
                  tablecell = new System.Web.UI.HtmlControls.HtmlTableCell();
                  lable1 = new Label();
                lable1.Text = "输入ID:";
                tablecell.Controls.Add(lable1);

                   tablecell2 = new System.Web.UI.HtmlControls.HtmlTableCell();

                tablecell2.Controls.Add(txtUname);


                tablerow1.Controls.Add(tablecell);
                tablerow1.Controls.Add(tablecell2);
                table.Controls.Add(tablerow1);


                this.Controls.Add(table);


                Button btnadd = new Button();
                btnadd.Attributes.Add("onclick", "<script>return confirm('确定新增?')</script>");
                btnadd.Text = "新增会签文员";
                this.Load += new EventHandler(btnadd_onclick);
                this.Controls.Add(btnadd);
            }
            private void btnadd_onclick(object sender, EventArgs e)
            {
                try
                {
                    SPWeb web = SPControl.GetContextWeb(Context);
                    SPList list = web.Lists["会签文员"];
                    SPListItemCollection lists = list.Items;
                    SPListItem listitem = list.Items.Add();

                    listitem["显示名称"] = txtUname.Text;

                    listitem["登录帐号"] = txtUid.Text;

                    listitem.Update();
                }
                catch (Exception ex)
                {
                   
                }
                   

            }
        }
    }

  • 相关阅读:
    dynamic和匿名对象
    生成1亿个不重复的8位随机整数
    Storage,Memcache,KVDB都是存储服务,如何区分何时用何种服务
    深入理解jQuery中$.get、$.post、$.getJSON和$.ajax的用法
    常用工具
    数字格式化,保留一位小数,无小数用0补充
    学习某些API的方法
    程序员的学习方法(程序员必看)【风中叶老师讲述】
    html的dtd声明
    数据库管理工具navicat基本使用方法——以MySql为例
  • 原文地址:https://www.cnblogs.com/IsNull/p/1701037.html
Copyright © 2020-2023  润新知