zoukankan      html  css  js  c++  java
  • 12.22 repeater 添加

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class Insert : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Session["uid"] != null)
    {
    if (!IsPostBack)
    {

    InfoDataContext context = new InfoDataContext();

    DropDownList1.DataSource = context.Nation;
    DropDownList1.DataTextField = "Name";
    DropDownList1.DataValueField = "Code";

    DropDownList1.DataBind();
    }

    }
    else
    {
    Response.Redirect("denglu.aspx");

    }

    }


    protected void Button1_Click(object sender, EventArgs e)
    {
    InfoDataContext context = new InfoDataContext();
    string code = txtCode.Text;
    string name = txtName.Text;
    bool sex = rdnan.Checked;
    string nation = DropDownList1.SelectedValue;
    DateTime birthday = Convert.ToDateTime(txtBirthday.Text);


    //造对象
    Info data = new Info();
    data.Code = code;
    data.Name = name;
    data.Sex = sex;
    data.Nation = nation;
    data.Birthday = birthday;

    //提交数据改动
    context.Info.InsertOnSubmit(data);

    context.SubmitChanges();

    //清空数据
    Clear();
    }

    public void Clear()
    {

    txtCode.Text = "";
    txtName.Text = "";
    txtBirthday.Text = "";
    DropDownList1.SelectedIndex = 0;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
    Response.Redirect("Main.aspx");
    }
    }

  • 相关阅读:
    MongoDb的备份与恢复
    MongoDb的安装
    常用的命令
    mysql的备份
    java基础
    List中的set方法和add方法
    git的基本指令
    网口扫盲三:以太网芯片MAC和PHY的关系
    网口扫盲二:Mac与Phy组成原理的简单分析
    Vue生命周期
  • 原文地址:https://www.cnblogs.com/cf924823/p/5065727.html
Copyright © 2011-2022 走看看