My code here, I want only product.name being updated. How do I do this ?
p/s: Give me many ways to do this

public ActionResult EditProduct(Product product)
        {

            if (ModelState.IsValid)
            {
                db.Entry(product).State = EntityState.Modified;

                db.SaveChanges();
            }

            return View();
        }

If you want only to allow product name to be updated do not allow other fields to changed by the user. otherwise it will make user upset if the changes can not be seen when he saved.

If you want you can just get the priduct name from form collection and do update.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.