protected void AddNewCustomer(object sender, EventArgs e)
{
Control control = null;
if (GridView1.FooterRow != null)
{
control = GridView1.FooterRow;
}
else
{
control = GridView1.Controls[0].Controls[0];
}
string SlNo = (control.FindControl("txtSlNo") as TextBox).Text;
string Code = (control.FindControl("txtcode") as TextBox).Text;
using (SqlConnection con = new SqlConnection(""))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO [Qtattemp] VALUES(@Code,@SlNo)";
cmd.Parameters.AddWithValue("@SlNo", SlNo);
cmd.Parameters.AddWithValue("@Code", Code);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}

Mukesh KumarRank #119 · 18.2K reputationPosted Oct 4, 2015, 11:05 PM EDT
Sivajihero Hero99 reputationPosted Oct 4, 2015, 11:08 PM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 4, 2015, 11:11 PM EDT
Abhishek KumarRank #510 · 4.8K reputationPosted Oct 4, 2015, 11:20 PM EDT
Sivajihero Hero99 reputationPosted Oct 4, 2015, 11:24 PM EDT
Abhishek KumarRank #510 · 4.8K reputationPosted Oct 5, 2015, 12:01 AM EDT
Jitendra KumarRank #760 · 3K reputationPosted Oct 5, 2015, 12:32 AM EDT