private void clearGrid() { DataTable dtdas = (DataTable)ViewState["dtbal"]; dtdas.Clear(); GridSeating.DataSource = null; GridSeating.DataBind(); lbltef.Text = "0"; lbltp1.Text = "0"; lbltpII.Text = "0"; lbltsA.Text = "0"; lbltsB.Text = "0"; lbltpp1.Text = "0"; lbltpp2.Text = "0"; lbltssA.Text = "0"; lbltssB.Text = "0"; }
public void selectno(string course, string part) { int i = 0, j; toseat = Convert.ToDecimal(lblToExamForms.Text); cpseat1 = Convert.ToDecimal(lblToPart1.Text); cpseat2 = Convert.ToDecimal(lbltoPartII.Text); csseat1 = Convert.ToDecimal(lblToSectionA.Text); csseat2 = Convert.ToDecimal(lblToSectinB.Text); apseat1 = Convert.ToDecimal(lblToPPPartI.Text); apseat2 = Convert.ToDecimal(lblToPPartII.Text); asseat1 = Convert.ToDecimal(lblToSSectionA.Text); asseat2 = Convert.ToDecimal(lblToSSectinB.Text); tos = Convert.ToDecimal(lbltef.Text); cps1 = Convert.ToDecimal(lbltp1.Text); cps2 = Convert.ToDecimal(lbltpII.Text); css1 = Convert.ToDecimal(lbltsA.Text); css2 = Convert.ToDecimal(lbltsB.Text); aps1 = Convert.ToDecimal(lbltpp1.Text); aps2 = Convert.ToDecimal(lbltpp2.Text); ass1 = Convert.ToDecimal(lbltssA.Text); ass2 = Convert.ToDecimal(lbltssB.Text); for (j = 0; j <= GridExamSub.Rows.Count; j++) { if (i < select) { if (GridExamSub.Rows[j].Cells[7].Text == course & GridExamSub.Rows[j].Cells[8].Text == part) { if (GridExamSub.Rows[j].Cells[7].Text == "Civil") { if (GridExamSub.Rows[j].Cells[8].Text == "PartI") { cpseat1 = cpseat1 + 1; cps1 = cps1 + 1; toseat = toseat + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "PartII") { cpseat2 = cpseat2 + 1; toseat = toseat + 1; cps2 = cps2 + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "SectionA") { csseat1 = csseat1 + 1; toseat = toseat + 1; css1 = css1 + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "SectionB") { csseat2 = csseat2 + 1; toseat = toseat + 1; css2 = css2 + 1; tos = tos + 1; } } else if (GridExamSub.Rows[j].Cells[7].Text == "Architecture") { if (GridExamSub.Rows[j].Cells[8].Text == "PartI") { apseat1 = apseat1 + 1; aps1 = aps1 + 1; toseat = toseat + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "PartII") { apseat2 = apseat2 + 1; toseat = toseat + 1; aps2 = aps2 + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "SectionA") { asseat1 = asseat1 + 1; toseat = toseat + 1; ass1 = ass1 + 1; tos = tos + 1; } else if (GridExamSub.Rows[j].Cells[8].Text == "SectionB") { asseat2 = asseat2 + 1; toseat = toseat + 1; ass2 = ass2 + 1; tos = tos + 1; } } DataTable dtdas = (DataTable)ViewState["dtbal"]; DataRow drNewRw = dtdas.NewRow(); drNewRw["SID"] = GridExamSub.Rows[j].Cells[0].Text; drNewRw["RollNo"] = GridExamSub.Rows[j].Cells[13].Text; drNewRw["SubCode"] = GridExamSub.Rows[j].Cells[1].Text; drNewRw["SubName"] = GridExamSub.Rows[j].Cells[2].Text; drNewRw["ExamSeason"] = GridExamSub.Rows[j].Cells[4].Text; drNewRw["Course"] = GridExamSub.Rows[j].Cells[7].Text; drNewRw["Part"] = GridExamSub.Rows[j].Cells[8].Text; drNewRw["CenterCode"] = GridExamSub.Rows[j].Cells[9].Text; drNewRw["CenterName"] = GridExamSub.Rows[j].Cells[10].Text; drNewRw["City"] = GridExamSub.Rows[j].Cells[12].Text; drNewRw["Date"] = ddlExaminationdate.SelectedValue.ToString(); drNewRw["Shift"] = ddlShift.SelectedValue.ToString(); drNewRw["RoomNo"] = lblRoomNo.Text.ToString(); dtdas.Rows.Add(drNewRw); GridSeating.DataSource = dtdas; GridSeating.DataBind(); i++; GridExamSub.Rows[j].Dispose(); GridExamSub.Rows[j].Cells[8].Text = "selected"; } } } lblToExamForms.Text = toseat.ToString(); lblToPart1.Text = cpseat1.ToString(); lbltoPartII.Text = cpseat2.ToString(); lblToSectionA.Text = csseat1.ToString(); lblToSectinB.Text = csseat2.ToString(); lblToPPPartI.Text = apseat1.ToString(); lblToPPartII.Text = apseat2.ToString(); lblToSSectionA.Text = asseat1.ToString(); lblToSSectinB.Text = asseat2.ToString(); lbltef.Text = tos.ToString(); lbltp1.Text = cps1.ToString(); lbltpII.Text = cps2.ToString(); lbltsA.Text = css1.ToString(); lbltsB.Text = css2.ToString(); lbltpp1.Text = aps1.ToString(); lbltpp2.Text = aps2.ToString(); lbltssA.Text = ass1.ToString(); lbltssB.Text = ass2.ToString(); }