protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { tblCategory = categoryAdpter.GetCategory(); ddl_Category.DataSource = tblCategory; ddl_Category.DataTextField = "CategoryName"; ddl_Category.DataValueField = tblCategory.CategoryIdColumn.ToString(); ddl_Category.DataBind(); ddl_Category.Items.Insert(0, new ListItem("Select Category", "-1")); tblProducts = productAdapter.GetProduct(); ddl_Product.DataSource = tblProducts; ddl_Product.DataTextField = "ProductName"; ddl_Product.DataValueField = tblProducts.ProductIdColumn.ToString(); ddl_Product.DataBind(); ddl_Product.Items.Insert(0, new ListItem("Select Product", "-1")); tblProductByCategory = adapter.GetProductsByCategory(); grdProducts.DataSource = tblProductByCategory; grdProducts.DataBind(); } }