string saleno = txtsalesno.Text;
string saldate = txtSalesDate.Text;
string ddcnt = ddCounterName.Text;
int prvsbil = Convert.ToInt32(disns);
string salprs = ddSalesPerson.Text;
int txqty = Convert.ToInt16(qtns);
float txrate = float.Parse(txtrate.Text);
float disct = float.Parse(rte);
float dsprs = float.Parse(distn);
float txtldis = float.Parse(totdistn);
float ttldisrupe = float.Parse(totdistnrs);
float custrles = float.Parse(cltotrs);
float cashrecd = float.Parse(txtcashreceved.Text);
float txbiamnt = float.Parse(txtbillamountcash.Text);
float cbalance = float.Parse(txtbalnce.Text);
DateTime bdte = Convert.ToDateTime(txtbdate.Text);
string cdte = System.DateTime.Now.ToString("yyyy/MM/dd");
string saletme = txtsalestime.Text;
DataTable dtCurrentTable = (DataTable)ViewState["Products"];
DataRow drCurrentRow = null;
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
{
Label box1 = (Label)ddsales.Rows[rowIndex].Cells[1].FindControl("lblsectn");
Label box2 = (Label)ddsales.Rows[rowIndex].Cells[2].FindControl("lblproductname");
Label box3 = (Label)ddsales.Rows[rowIndex].Cells[3].FindControl("lbllotno");
Label box4 = (Label)ddsales.Rows[rowIndex].Cells[3].FindControl("lblmrp");
Label box5 = (Label)ddsales.Rows[rowIndex].Cells[3].FindControl("lblsupliername");
Label box6 = (Label)ddsales.Rows[rowIndex].Cells[3].FindControl("lblsizee");
sc.Add(saleno + "," + saldate + "," + ddcnt + "," + prvsbil + "," + salprs + "," + txqty + "," + txrate +"," + disct + "," + dsprs + "," + txtldis + "," + ttldisrupe+ "," + custrles + "," +cbalance+"," + cashrecd + "," +bdte+","+saletme+","+ box1.Text +"," + box2.Text + ","+ box3.Text + "," + box4.Text + "," + txqty+","+box5.Text+","+box6.Text+"," + cdte);
rowIndex++;
}
InsertRecords(sc);
}
ViewState["Products"]=null;
it will work properly