protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
GridView1.Visible = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("spInsertData", new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()));
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@name", txtName.Text);
cmd.Parameters.AddWithValue("@city", txtCity.Text);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
Label1.Text = "<b>" + txtName.Text + "</b> has been added to the database using a Stored Procedure.";
}
}