Unit 2 Practical 4
Create a database with two tables as "Category", which contain category id and category name and "Products" which contain products details such as prod_id, cat_id, prod_name, price, description, prodimgurl) for each product. Display name of all the categories in a DropDownList and according to user's choice, particular categories product's details record should display in a Griview control. Allow to update and delete records through the gridview.
First you have to add SQL Server Database from solution explorer add new item > Sql server database and named it as productDB.mdf After that you have to create two tables "category" and "products" from server exlporer.
category:
Create table category(cat_id int Primary Key IDENTITY, cat_name varchar(50));
products:
create table products( prod_id int Primary Key IDENTITY, prod_name varchar(50), price decimal(10,2), description varchar(500), prodimgurl varchar(500), cat_id int, foreign key(cat_id) references category(cat_id) );
U2_P4.aspx
OUTPUT:
