I have a page with 2 grid views
in the first one i can select one more more rows and click on add button outside the grid will remove the data from that grid and add to the second grid. This part is working perfectly
In the second grid,i have an ImageButton to perform remove action , This should remove the data from second (this is working) and should add this to first Grid. This section is not working. But if I refresh the page, the first grid is showing the removed data.
here is my code
protected void gvQCOrder_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = Convert.ToInt32(gvQCOrder.DataKeys[e.RowIndex].Value);
SqlConnection objCon = new SqlConnection(SqlHelper.GetConnection("Conns"));
SqlTransaction Strac;
objCon.Open();
Strac = objCon.BeginTransaction();
try
{
List<SqlParameter> array = new List<SqlParameter>();
array.Add(new SqlParameter("@QCAuditID", id));
SqlCommand cmd1 = new SqlCommand("[USP_del_QCOrder]", objCon, Strac);
int result1 = DAL.executeSaveMultipleQuery(cmd1, CommandType.StoredProcedure, array);
Strac.Commit();
}
catch (Exception ex)
{
Strac.Rollback();
}
finally
{
createdtStructure();
bindValues();
}
}
code for bind values
private void bindValues()
{
if (Session["OrderId"] != null)
{
int OrderId = Convert.ToInt32(Session["OrderId"].ToString());
List<SqlParameter> _params = new List<SqlParameter>();
_params.Add(new SqlParameter("@OrderId", OrderId));
DataSet dsQC = DAL.executeDataSet("Usp_OrderDetails", _params, CommandType.StoredProcedure);
vdtHead = dsQC.Tables[0];
lblTxtQMS.Text = vdtHead.Rows[0]["QS_Nbr"].ToString();
lblTxtFiles.Text = vdtHead.Rows[0]["Files_Ordered"].ToString();
dtAudits = dsQC.Tables[1];
createdtStructure();
if (dtAudits.Rows.Count > 0)
{
gvOrderMgnt.DataSource = dtAudits;
gvOrderMgnt.DataBind();
gvOrderMgnt.SelectedIndex = -1;
}
List<SqlParameter> list = new List<SqlParameter>();
list.Add(new SqlParameter("@OrderId", OrderId));
DataTable dtId = DAL.executeDataTable("Usp_Check_OrderHeader", list, CommandType.StoredProcedure);
if (dtId.Rows.Count > 0)
{
List<SqlParameter> list1 = new List<SqlParameter>();
list1.Add(new SqlParameter("@OrderId", Convert.ToInt32(dtId.Rows[0]["ID"].ToString())));
dtQCAudit = DAL.executeDataTable("usp_QC_OrderDetails", list1, CommandType.StoredProcedure);
gvQCOrder.DataSource = dtQCAudit;
gvQCOrder.DataBind();
if (dtQCAudit.Rows.Count>0)
lblQCNo.Text=dtQCAudit.Rows[0]["QC_Nbr"].ToString();
btnCreate.Visible = false;
btnDelete.Visible = true;
btnAdd.Visible = true;
}
else
{
dtQCAudit = null;
gvQCOrder.DataSource = dtQCAudit;
gvQCOrder.DataBind();
btnCreate.Visible = true;
btnAdd.Visible = false;
btnDelete.Visible = false;
}
}
}
please correct me