I have created label and text box and one add button and save button when i click on add button label and textbox will be added and when i click on save button data will added to database and only one name is saving (another dynamic created textbox values not inserting into database )what i have do enter all the textbox values my code is
In model.cs
public void adddata(string Name)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());
SqlCommand cmd = new SqlCommand("addvalues", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Name", Name);
con.Open();
cmd.ExecuteScalar();
con.Close();
}
And in controller.cs is
public Action Result Add(database db)
{
database objdb = new database();
objdb.adddata(db.Name);
return View();
}
In the second pic i click on save button only first text box data is enter into database remaining not inserting then what i have to do to enter all text box values