Sunday 7 February 2021

Part 24: Brand Name DropDownList

In this article we will succssfully update Create,Edit and Index action of product details and will achive following output.Sample code available on github
Before continuing this article please delete all classes under migration folder available under root directory of project and all tables from database. I will show you how to revert migration without deleting database in future article.
  Add BrandId property in below model(ProductDetails) shown below.
Open package manager console and execute Add-Migration and Update-Database commands.
All table gets created under database and fresh migration classes added under Migration folder.
  Update Edit action method of Product Details controller highlighted below for Brand dropdownlist.
  Update Edit action view shown below.
Update Create action method of Product Details controller highlighted below for Brand dropdown list.
  Update Edit view for dropdown list.
Update Index page of Product Details controller.
  Run application and check browser.
First Click on Edit button from above highlighted screen.
Edit view with dropdown list populated selected brand. Now go back to index view and click on Create New action link.
Dropdown populated with available list of Brands from database.
Open Index action method of ProductDetails controller. Reading Brand name and concatenating brand name with Phone name shown below.
Run application and check in browser window.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home