private void btnSubmit_ServerClick(object sender, System.EventArgs e) { BEPromotions promotions = new BEPromotions(); BPPromotions bp = new BPPromotions(); promotions = bp.SelectAll(); int counter = 1; while (this.FindControl("pnlPromotion" + counter.ToString()) != null && ((Panel)this.FindControl("pnlPromotion" + counter.ToString())).Visible != false) { BEPromotions.tbl_PromotionsRow dr; if (promotions.tbl_Promotions.Rows.Count >= counter) { dr = promotions.tbl_Promotions[counter-1]; } else { dr = promotions.tbl_Promotions.Newtbl_PromotionsRow(); } FillDataRowFromTextBoxes(counter.ToString(),dr); if (promotions.tbl_Promotions.Rows.Count < counter) { promotions.tbl_Promotions.Addtbl_PromotionsRow(dr); } //CreateResizedImage(BEImages DSImages, int ImageID, string prefix, int width, int height, Page page) if (!dr.IsPromotionImageIDNull()) { MWUtility.CreateResizedImage(dr.PromotionImageID, "promo", "", promotionImageSize, 0, this); } counter++; } bp.Update(promotions); Response.Redirect("index.aspx"); }