A for
loop for the true condition sends a parameter to stored procedure and then required result is stored in a DataTable
. Now my problem is at every loop the value in the DataTable
gets refreshed with new value and previous value gets lost. How to retain all the value of true condition in the DataTable
?
for (int i = 0; i < gridview1.Rows.Count; i++)
{
string yojnaNo = "";
CheckBox chl = (CheckBox)gridview1.Rows[i].Cells[0].FindControl("CheckBox1");
if (chl != null)
{
if (chl.Checked == true)
{
int rowsNo = (Convert.ToInt16(chl.ToolTip) - 1); //Convert.ToInt16(SrNo);
yojnaNo = ((Label)gridview1.Rows[rowsNo].FindControl("lblYojnaNo")).Text;
sc.Add(yojnaNo);
}
}
objyojnadetail4.YojnaNo = sc;
DataTable city = objyojnadetail4.Selectcity();
}