protected void Targetvaluemgmt_grid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete_targetvalue")
        {
            using (SqlConnection Conn = new SqlConnection())
            {
                Conn.ConnectionString = ConfigurationManager.ConnectionStrings["DBpath"].ConnectionString;
                SqlCommand Comm = new SqlCommand();
                Comm.Connection = Conn;
                Conn.Open();

                try
                {
                    Comm.CommandText = "DELETE FROM TARGETVALUE WHERE ID=@ID";
                    Comm.Parameters.Add("@ID", SqlDbType.Int);
                    Comm.Parameters["@ID"].Value = Targetvaluemgmt_grid.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();

                    Comm.ExecuteNonQuery();
                    Targetvaluemgmt_grid.DataBind();

                    Error_lb.ForeColor = Color.Green;
                    Error_lb.Text      = "Data deleted";
                }
                catch (SqlException E)
                {
                    Error_lb.Text = E.Message;
                    return;
                }
            }
        }
    }
    protected void add_btn_Click(object sender, EventArgs e)
    {
        using (SqlConnection Conn = new SqlConnection())
        {
            Conn.ConnectionString = ConfigurationManager.ConnectionStrings["DBpath"].ConnectionString;
            SqlCommand Comm = new SqlCommand();
            Comm.Connection = Conn;
            Conn.Open();

            try
            {
                Comm.CommandText = "INSERT INTO TARGETVALUE(NAME) VALUES (@NAME)";
                Comm.Parameters.Add("@NAME", SqlDbType.NVarChar);
                Comm.Parameters["@NAME"].Value = Targetval_edt.Text.Trim();


                Comm.ExecuteNonQuery();
                Targetvaluemgmt_grid.DataBind();

                Targetval_edt.Text = "";



                Error_lb.ForeColor = Color.Green;
                Error_lb.Text      = "Data added successfully";
            }
            catch (SqlException E)
            {
                Error_lb.Text = E.Message;
                return;
            }
        }
    }
 protected void Targetvaluemgmt_grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     SqlDataSource1.UpdateCommand = @"UPDATE TARGETVALUE SET NAME = @NAME WHERE ID = @ID";
     Targetvaluemgmt_grid.DataBind();
 }