protected void GridViewCatalogue_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { InventoryCatalogue catalogue = (InventoryCatalogue)e.Row.DataItem; string ItemID = catalogue.ItemID; Label lblCatName = e.Row.FindControl("LblCatalogueName") as Label; if (lblCatName != null) { lblCatName.Text = InventoryLogic.GetCatalogueName(catalogue.CategoryID); } DropDownList ddl = e.Row.FindControl("DdlCategoryID") as DropDownList; if (ddl != null) { ddl.DataSource = InventoryLogic.CategoryID(); ddl.DataTextField = "CategoryID"; ddl.DataValueField = "CategoryID"; ddl.DataBind(); } } }