protected void fillFirstGrid() { String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); String prodName = Session[SessionFactory.ALL_PRODUCT_SELECTED_PRODUCT_NAME].ToString(); Dictionary <String, ShopChildProdsSpecs> prodSpecDict = BackEndObjects.ShopChildProdsSpecs. getShopChildProdsSpecObjbyEntIdandProdNameDB(entId, prodName); Dictionary <String, String> existingFeatList = new Dictionary <string, string>(); DataTable dt = new DataTable(); dt.Columns.Add("FeatId"); dt.Columns.Add("FeatName"); dt.Columns.Add("SpecText"); dt.Columns.Add("FromSpec"); dt.Columns.Add("ToSpec"); dt.Columns.Add("imgName"); int counter = 0; foreach (KeyValuePair <String, ShopChildProdsSpecs> kvp in prodSpecDict) { ShopChildProdsSpecs specObj = (ShopChildProdsSpecs)kvp.Value; dt.Rows.Add(); existingFeatList.Add(specObj.getFeatId(), specObj.getFeatId()); dt.Rows[counter]["FeatId"] = specObj.getFeatId(); dt.Rows[counter]["FeatName"] = Features.getFeaturebyIdwoSpecDB(specObj.getFeatId()).getFeatureName(); dt.Rows[counter]["SpecText"] = specObj.getSpecText(); if (!specObj.getFromSpecId().Equals("")) { dt.Rows[counter]["FromSpec"] = Specifications.getSpecificationDetailbyIdDB(specObj.getFromSpecId()).getSpecName(); } if (!specObj.getToSpecId().Equals("")) { dt.Rows[counter]["ToSpec"] = Specifications.getSpecificationDetailbyIdDB(specObj.getToSpecId()).getSpecName(); } String[] imgPath = specObj.getImgPath().Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); dt.Rows[counter]["imgName"] = (imgPath != null && imgPath.Length > 0 ? imgPath[imgPath.Length - 1] : "N\\A"); counter++; } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; GridView1.Columns[2].Visible = false; Session[SessionFactory.PRODUCT_SPECIFICATION_EXISTING_FEAT_LIST] = existingFeatList; Session[SessionFactory.ALL_PROD_SPECIFICATION_DATAGRID] = dt; }