public void authorititescontacted() { SqlCommand cmd = new SqlCommand("Proc_Anti_Ragging1", con); cmd.CommandType = CommandType.StoredProcedure; string collegeId = Session["CollegeId"].ToString(); cmd.Parameters.AddWithValue("@CollegeId", collegeId); cmd.Parameters.AddWithValue("@Qtype", 2); cmd.Parameters.AddWithValue("@Year", ddlyear.SelectedItem.Text); cmd.Parameters.AddWithValue("@Duration", rbd1.Checked ? "By 31st Oct" : "By 30th Apr"); cmd.Parameters.AddWithValue("@authoritites_Name", txtauthorititesname.Text); cmd.Parameters.AddWithValue("@authoritites_Designation", txtauthorititesdesig.Text); cmd.Parameters.AddWithValue("@authoritites_Contact", txtauthorititescontact.Text); con.Open(); cmd.ExecuteNonQuery(); con.Close(); if (!string.IsNullOrEmpty(txtauthorititesname1.Text) || !string.IsNullOrEmpty(txtauthorititesdesig2.Text) || !string.IsNullOrEmpty(txtauthorititescontact3.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname1.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig2.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact3.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname4.Text) || !string.IsNullOrEmpty(txtauthorititesdesig5.Text) || !string.IsNullOrEmpty(txtauthorititescontact6.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname4.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig5.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact6.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname7.Text) || !string.IsNullOrEmpty(txtauthorititesdesig8.Text) || !string.IsNullOrEmpty(txtauthorititescontact9.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname7.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig8.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact9.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname10.Text) || !string.IsNullOrEmpty(txtauthorititesdesig11.Text) || !string.IsNullOrEmpty(txtauthorititescontact12.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname10.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig11.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact12.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname13.Text) || !string.IsNullOrEmpty(txtauthorititesdesig14.Text) || !string.IsNullOrEmpty(txtauthorititescontact15.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname13.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig14.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact15.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname16.Text) || !string.IsNullOrEmpty(txtauthorititesdesig17.Text) || !string.IsNullOrEmpty(txtauthorititescontact18.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname16.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig17.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact18.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname19.Text) || !string.IsNullOrEmpty(txtauthorititesdesig20.Text) || !string.IsNullOrEmpty(txtauthorititescontact21.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname19.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig20.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact21.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname22.Text) || !string.IsNullOrEmpty(txtauthorititesdesig23.Text) || !string.IsNullOrEmpty(txtauthorititescontact24.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname22.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig23.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact24.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } if (!string.IsNullOrEmpty(txtauthorititesname25.Text) || !string.IsNullOrEmpty(txtauthorititesdesig26.Text) || !string.IsNullOrEmpty(txtauthorititescontact27.Text)) { cmd.Parameters["@authoritites_Name"].Value = txtauthorititesname25.Text; cmd.Parameters["@authoritites_Designation"].Value = txtauthorititesdesig26.Text; cmd.Parameters["@authoritites_Contact"].Value = txtauthorititescontact27.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } }
Above is my code when i click on submit button and fill data all textbox then it creates 10 row in my table so i want to know how to make column when i click on submit button then save all record in same value 10 times like UID00000001,UID00000001----------and when i click second time on submit button then row will create likeUID00000002,UID00000002------------and to call on my cs page so please help me