📄 updatepinmin.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 updatepinmin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cooktb leibie = new cooktb();
this.dropleibie.DataSource = leibie.leibie();
this.dropleibie.DataTextField = "leibie_name";
dropleibie.DataBind();
leibie.leibie().Dispose();
GridviewBind();
}
}
protected void btnsearch_Click(object sender, EventArgs e)
{
GridviewBind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
GridviewBind();
}
private void GridviewBind()
{
try
{
order pinmin = new order();
DataSet ds = pinmin.selectpinmin(this.dropleibie.SelectedItem.Text, this.dropnature.SelectedItem.Text);
GridView1.DataSource = ds;
GridView1.DataBind();
}
catch (Exception ex)
{ }
}
protected void GridView1_RowCancelingEdit1(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
GridviewBind();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
Label lblname = (Label)GridView1.Rows[e.RowIndex].FindControl("lblname");
DropDownList supply = (DropDownList)GridView1.Rows[e.RowIndex].Cells[1].FindControl("dropsupply");
TextBox txtGG = (TextBox)GridView1.Rows[e.RowIndex].Cells[2].FindControl("TextBox2");
DropDownList leibie = (DropDownList)GridView1.Rows[e.RowIndex].Cells[3].FindControl("dropleibie");
DropDownList dropnature = (DropDownList)GridView1.Rows[e.RowIndex].Cells[4].FindControl("dropnature");
TextBox txtprice = (TextBox)GridView1.Rows[e.RowIndex].Cells[5].FindControl("TextBox5");
TextBox txtsuoxie = (TextBox)GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox6");
order update = new order();
update.updateorderthing(id, supply.SelectedItem.Text, txtGG.Text, leibie.SelectedItem.Text, dropnature.SelectedItem.Text, txtprice.Text, txtsuoxie.Text);
GridView1.EditIndex = -1;
GridviewBind();
GridView1.EditIndex = -1;
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//if (e.Row.RowState == DataControlRowState.Edit)
//{
// DropDownList dp = (DropDownList)e.Row.Cells[1].FindControl("dropsupply");
// order supply = new order();
// dp.DataSource = supply.selectsupply();
// dp.DataTextField = "supply_Name";
// dp.DataBind();
// supply.selectsupply().Dispose();
// DropDownList dpleibie = (DropDownList)e.Row.Cells[3].FindControl("dropleibie");
// cooktb tb = new cooktb();
// dpleibie.DataSource = tb.leibie();
// dpleibie.DataTextField = "leibie_name";
// dpleibie.DataBind();
// tb.leibie().Dispose();
//}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -