protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { SqlConnection cn = new SqlConnection("Data Source=ANCYCHACKO-TOSH;Initial Catalog=tallysoftware;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); cn.Open(); GridViewRow row = GridView1.Rows[e.RowIndex]; DropDownList dropdownlist1 = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("dropdownlist1"); TextBox txtEcollected = (TextBox)row.FindControl("txtEcollected"); TextBox txtEplan = (TextBox)row.FindControl("txtEplan"); TextBox txtEacoll = (TextBox)row.FindControl("txtEacoll"); DropDownList dropdownlist2 = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("dropdownlist2"); TextBox txtEre = (TextBox)row.FindControl("txtEre"); TextBox txtEdescrptn = (TextBox)row.FindControl("txtEdescrptn"); int Id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); string se_name = dropdownlist1.SelectedItem.Text; string collected_date = txtEcollected.Text; string amount_plan = txtEplan.Text; string amount_collected = txtEacoll.Text; string status_ar = dropdownlist2.SelectedItem.Text; string remark = txtEre.Text; string description = txtEdescrptn.Text; cmd.CommandText = "UPDATE tbl_bill SET se_name='" + dropdownlist1.SelectedItem.Text + "' ,collected_date ='" + txtEcollected.Text + "',amount_plan ='" + txtEplan.Text + "',amount_collected ='" + txtEacoll.Text + "',status_ar ='" + dropdownlist2.SelectedItem.Text + "',remark='" + txtEre.Text + "',description='" + txtEdescrptn.Text + "' WHERE id=" + Id + "'"; cmd.ExecuteNonQuery(); GridView1.EditIndex = -1; Grid(); cn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)