hi ,
I have a grid which has check boxes and when selecting the top chek box select all will select all the check box in gridview and would update .for this im using for loop where it exceutes every time and this is taking lot of time cuase there are more thn 100 records in grid .
try
{
string StrOutputMessageDisplayDocReqCsu = string.Empty;
string strid = string.Empty;
string strflag = string.Empty;
string strSelected = string.Empty;
for (int j = 0; j < GdvDocReqMU.Rows.Count; j++)
{
CheckBox Chkupdate = (CheckBox)GdvDocReqMU.Rows[j].Cells[1].FindControl("chkDR");
if (Chkupdate != null)
{
if (Chkupdate.Checked)
{
strid = ((Label)GdvDocReqMU.Rows[j].FindControl("lblIDDocReqCsu")).Text;
strflag = ((Label)GdvDocReqMU.Rows[j].FindControl("lblStatusDocReqCsu")).Text;
cmd = new SqlCommand("sp_Update_v1", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id", strSelected);
cmd.Parameters.AddWithValue("@flag", DdlStatusDocReqMU.SelectedValue);
cmd.Parameters.AddWithValue("@notes", txtnotesDocReqMU.Text);
cmd.Parameters.AddWithValue("@user", strUseridDRAhk);
cmd.Parameters.Add(new SqlParameter("@message", SqlDbType.VarChar, 100, ParameterDirection.Output, false, 0, 50, "message", DataRowVersion.Default, null));
cmd.UpdatedRowSource = UpdateRowSource.OutputParameters;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
//}
StrOutputMessageDisplayDocReqCsu += (string)cmd.Parameters["@message"].Value + "<br/>";
lbldbmessDocReqAhk.Text += StrOutputMessageDisplayDocReqCsu + "<br>";
GetgridDocReq();
}
catch (Exception ex)
{
lbldbmessDocReqAhk.Text = ex.Message.ToString();
}
can some please help me on this where i can capture all the id in one string n pass it to procedure
Thanks