zoukankan      html  css  js  c++  java
  • GridView利用FootTemplate插入新记录

    首先拖一个GridView到页面,然后把非自己生成的项转化为TemplateItemField的,然后在每一项的FootTemplate处拖上相应的填写新数据的控件,在Foot的合适位置放一块Button,这里命名为ButtonInsert,该控件负责把数据塞入数据库并隐藏Foot。然GridView的下面再放一个按钮,用于显示Foot,这里命名为ButtonAdd。

    核心代码:

        protected void ButtonAdd_Click(object sender, EventArgs e)
        {
            this.GridView1.ShowFooter = true;
        }
        protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            TextBox textboxname=this.GridView1.FooterRow.FindControl("TextBoxWorkareaname") as TextBox;
            string name = textboxname.Text;

        //此处加入插入数据库的代码
            this.GridView1.ShowFooter = false;
        }

  • 相关阅读:
    JavaScript和DOM
    CSS补充以及后台页面布局
    HTML标签和CSS基础
    基于SQLAlchemy实现的堡垒机
    PymySQL
    SQLAlchemy
    负数取模
    list
    算法(3)
    python初识(3)
  • 原文地址:https://www.cnblogs.com/CUCmehp/p/1333298.html
Copyright © 2011-2022 走看看