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;
        }

  • 相关阅读:
    centos 7 安装maven
    linux添加用户
    intellij添加jar包
    mysql用户管理
    centos7 mariaDB安装
    hibernate入门实例
    Linux文件描述符
    Python小爬虫实例
    IO流-文件管理
    IO流-ZIP文档
  • 原文地址:https://www.cnblogs.com/CUCmehp/p/1333298.html
Copyright © 2011-2022 走看看