62,269
社区成员
发帖
与我相关
我的任务
分享
protected void Button4_Click(object sender, EventArgs e)
{
if (this.TextBox6.Text != "" && this.TextBox7.Text != "" && this.TextBox8.Text != "" && this.TextBox9.Text != "" && this.TextBox10.Text != "" && this.TextBox11.Text != "")
{
DataTable dt = new DataTable();
dt.Columns.Add("clothname");
dt.Columns.Add("color");
dt.Columns.Add("purpose");
dt.Columns.Add("source");
dt.Columns.Add("technology_Width");
dt.Columns.Add("technology_singleexpend");
dt.Columns.Add("cutout_Width");
dt.Columns.Add("cutout_singleexpend");
dt.Columns.Add("stock_Width");
dt.Columns.Add("stock_singleexpend");
dt.Columns.Add("clientprovider_Width");
dt.Columns.Add("clientprovider_singleexpend");
DataRow dr = dt.NewRow();
dr["clothname"] = this.TextBox6.Text.ToString();
dr["color"] = this.TextBox7.Text.ToString();
dr["purpose"] =this.DropDownList2.Text.ToString();
dr["source"] =this.DropDownList3.Text.ToString();
dr["technology_Width"] =this.DropDownList4.Text.ToString();
dr["technology_singleexpend"] =this.TextBox8.Text.ToString();
dr["cutout_Width"] =this.DropDownList5.Text.ToString();
dr["cutout_singleexpend"] =this.TextBox9.Text.ToString();
dr["stock_Width"] =this.DropDownList6.Text.ToString();
dr["stock_singleexpend"] =this.TextBox10.Text.ToString();
dr["clientprovider_Width"] =this.DropDownList7.Text.ToString();
dr["clientprovider_singleexpend"] = this.TextBox11.Text.ToString();
dt.Rows.Add(dr);
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}else
{
MessageBox.Show(Button4, Button4.GetType(), "请将数据填写完整!");
}
protected void Button4_Click(object sender, EventArgs e)
{
if (this.TextBox6.Text != "" && this.TextBox7.Text != "" && this.TextBox8.Text != "" && this.TextBox9.Text != "" && this.TextBox10.Text != "" && this.TextBox11.Text != "")
{
DataTable dt = null;
if(ViewState["dt"]!=null)
{
dt = (DataTable)ViewState["dt"];
DataRow dr = dt.NewRow();
dr["clothname"] = this.TextBox6.Text.ToString();
dr["color"] = this.TextBox7.Text.ToString();
dr["purpose"] =this.DropDownList2.Text.ToString();
dr["source"] =this.DropDownList3.Text.ToString();
dr["technology_Width"] =this.DropDownList4.Text.ToString();
dr["technology_singleexpend"] =this.TextBox8.Text.ToString();
dr["cutout_Width"] =this.DropDownList5.Text.ToString();
dr["cutout_singleexpend"] =this.TextBox9.Text.ToString();
dr["stock_Width"] =this.DropDownList6.Text.ToString();
dr["stock_singleexpend"] =this.TextBox10.Text.ToString();
dr["clientprovider_Width"] =this.DropDownList7.Text.ToString();
dr["clientprovider_singleexpend"] = this.TextBox11.Text.ToString();
dt.Rows.Add(dr);
}
else
{
dt = new DataTable();
dt.Columns.Add("clothname");
dt.Columns.Add("color");
dt.Columns.Add("purpose");
dt.Columns.Add("source");
dt.Columns.Add("technology_Width");
dt.Columns.Add("technology_singleexpend");
dt.Columns.Add("cutout_Width");
dt.Columns.Add("cutout_singleexpend");
dt.Columns.Add("stock_Width");
dt.Columns.Add("stock_singleexpend");
dt.Columns.Add("clientprovider_Width");
dt.Columns.Add("clientprovider_singleexpend");
DataRow dr = dt.NewRow();
dr["clothname"] = this.TextBox6.Text.ToString();
dr["color"] = this.TextBox7.Text.ToString();
dr["purpose"] =this.DropDownList2.Text.ToString();
dr["source"] =this.DropDownList3.Text.ToString();
dr["technology_Width"] =this.DropDownList4.Text.ToString();
dr["technology_singleexpend"] =this.TextBox8.Text.ToString();
dr["cutout_Width"] =this.DropDownList5.Text.ToString();
dr["cutout_singleexpend"] =this.TextBox9.Text.ToString();
dr["stock_Width"] =this.DropDownList6.Text.ToString();
dr["stock_singleexpend"] =this.TextBox10.Text.ToString();
dr["clientprovider_Width"] =this.DropDownList7.Text.ToString();
dr["clientprovider_singleexpend"] = this.TextBox11.Text.ToString();
dt.Rows.Add(dr);
}
ViewState["dt"] = dt;
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}else
{
MessageBox.Show(Button4, Button4.GetType(), "请将数据填写完整!");
}
}