I am currently getting data from database, then if i checked the checkbox more than 2 rows, it will sum up the total of
SENDQTY
and send the details from
GridView3
to
GridView4
.
What I have tried:
Now how can i check if the
STOCKCODE
from the 2 rows is different, it will prompt error message?
protected void showGridView()
{
int match = 0;
int total = 0;
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[9] { new DataColumn("DODetailID"), new DataColumn("SALESORDERNO"), new DataColumn("STOCKCODE"), new DataColumn("SENDQTY"), new DataColumn("scanflag"), new DataColumn("REJECT"), new DataColumn("DispatchOrderID"), new DataColumn("DispatchDATE"), new DataColumn("DELORDERNO") });
foreach (GridViewRow row in GridView3.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
CheckBox CheckBox1 = (row.Cells[0].FindControl("CheckBox1") as CheckBox);
if (CheckBox1.Checked)
{
string DODetailID = (row.Cells[1].FindControl("DODetailID") as Label).Text;
string SALESORDERNO = (row.Cells[2].FindControl("SALESORDERNO") as Label).Text;
string STOCKCODE = (row.Cells[3].FindControl("STOCKCODE") as Label).Text;
int SENDQTY = Convert.ToInt32((row.Cells[4].FindControl("SENDQTY") as Label).Text);
CheckBox scanflag = (row.Cells[5].FindControl("scanflag") as CheckBox);
string REJECT = (row.Cells[6].FindControl("REJECT") as Label).Text;
string DispatchOrderID = (row.Cells[7].FindControl("DispatchOrderID") as Label).Text;
string DispatchDATE = (row.Cells[8].FindControl("DispatchDATE") as Label).Text;
string DELORDERNO = (row.Cells[9].FindControl("DELORDERNO") as Label).Text;
Session["STOCKCODE"] = STOCKCODE.ToString();
dt.Rows.Add(DODetailID, SALESORDERNO, STOCKCODE, SENDQTY, scanflag, REJECT, DispatchOrderID, DispatchDATE, DELORDERNO);
match++;
total = total + SENDQTY;
GridView4.DataSource = dt;
GridView4.DataBind();
}
}
}
}
protected void btnContinue_Click(object sender, EventArgs e)
{
showGridView();
mp3.Show();
}