zoukankan      html  css  js  c++  java
  • 20151217:Web之Repeater使用:修改

    修改界面后台C#代码:

    public partial class Update : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string ids = Request["ids"].ToString();
                //显示原来的数据
                TestDataContext context = new TestDataContext();
                Fruit data = context.Fruit.Where(p => p.Ids == ids).First();//查询
                txtCode.Text = data.Ids;//传值
                txtName.Text = data.Name;
                txtPrice.Text = data.Price.ToString();
                txtSource.Text = data.Source;
                txtNumbers.Text = data.Numbers.ToString();
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            TestDataContext context = new TestDataContext();
            Fruit data = context.Fruit.Where(p => p.Ids == txtCode.Text).First();
            data.Name = txtName.Text;
            data.Price = Convert.ToDecimal(txtPrice.Text);
            data.Source = txtSource.Text;
            data.Numbers = Convert.ToInt32(txtNumbers.Text);
            context.SubmitChanges();
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("1217.aspx");//跳转页面
        }
    }

  • 相关阅读:
    【Struts2】 国际化
    【Struts2】进阶
    【Struts2】简介及入门
    【Distributed】互联网安全架构
    【Mac】 开启原生的 NTFS 硬盘格式支持
    swagger2简单使用
    自定义异常和异常处理
    enum简单使用
    Interceptor
    修改docker下mysql配置
  • 原文地址:https://www.cnblogs.com/mn-b/p/5074488.html
Copyright © 2011-2022 走看看