default.aspx.cs

来自「这是asp.net^和Visual C++Sharp编写的串并口通讯的书籍 源代」· CS 代码 · 共 47 行

CS
47
字号
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    DataBase data = new DataBase();
    protected void Page_Load(object sender, EventArgs e)
    {
        GridView1.DataSource = data.GetDataSet("select * from tb_TwoLayer", "table");
        GridView1.DataBind();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        bool bl = data.ExecSQL("insert into tb_TwoLayer values('" + txtGoodsID.Text + "','" + txtGoodName.Text + "','" + txtMark.Text + "','" + txtType.Text + "','" + txtPrise.Text + "','" + txtUnit.Text + "','" + txtMemo.Text + "')");
        if (bl)
        {

            WebMessageBox.Show("添加成功!", "");
            GetWindows.GotoParentWindow("default.aspx");
        }
        else
        {
            WebMessageBox.Show("添加失败!", "");
            GetWindows.GotoParentWindow("default.aspx");
        }
        GridView1.DataSource = data.GetDataSet("select * from tb_TwoLayer", "table");
        GridView1.DataBind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[1].Text = OutPutString.HighLight(e.Row.Cells[1].Text,true);
            e.Row.Attributes.Add("onmouseOver", "color=this.style.backgroundColor;this.style.backgroundColor='yellow'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=color");
            e.Row.Cells[6].Text = OutPutString.Out(e.Row.Cells[6].Text, 6);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?