protected void Button1_Click1(object sender, EventArgs e) { int i = 0,j=0; string[] cmbb= new string[10]; foreach (AjaxControlToolkit.ComboBox tb in dynamiccombobox) { cmbb [i] = tb.SelectedItem.Text ; i++; } string[] tbb = new string[10]; foreach (TextBox tb in dynamicTextBoxes) { tbb[j] = tb.Text; j++; } Hashtable data = new Hashtable(); data.Add("client_id", cbclientnme.SelectedValue); data.Add("cc_id", cbclientcont.SelectedValue); data.Add("doc", txtdoc.Text); data.Add("probtype", cbprobtype.SelectedValue); data.Add("probsubtype", cbprobtype0.SelectedValue); data.Add("priority", ddlpriority.SelectedValue); data.Add("taskdesc", txtxtaskdesc.Text); data.Add("others", txtothers.Text); data.Add("emp_reg",Session["empid"]); data.Add("eta", txteta.Text); int a = Convert.ToInt32(Session["combosel"]); bll noof = new bll(); int w, z,tn,cn,tc=0,cc=0; Hashtable datano = new Hashtable(); datano = noof.noofrows(a); w = Convert.ToInt32(datano ["noofrows"]); tn = Convert.ToInt32(datano["nooftxt"]); cn = Convert.ToInt32(datano["noofcb"]); dynamicTextBoxes = new TextBox[tn]; dynamiccombobox = new AjaxControlToolkit.ComboBox[cn]; Table tbl = new Table(); for (z = 0; z < w; z++) { bll cuscontrol = new bll(); Hashtable data1 = new Hashtable(); data1 = cuscontrol.ccomp(a, z); if (data1["control"].ToString() == "Textbox") { string value = data1["id"].ToString(); value += ","; value+=tbb[tc]; data.Add(z, value); tc++; } else if (data1["control"].ToString() == "Combobox") { string value = data1["id"].ToString(); value += ","; value += cmbb [cc]; data.Add(z, value); cc++; } } for (int h = w; h < 20; h++) { data.Add(h, ""); } int id; bll inscomp = new bll(); id=inscomp.inscomplaindet(data); lblretticketid.Text = "Complain Details Inserted & Ticket ID is " + id.ToString(); }