protected void btnSubmit_Click(object sender, EventArgs e) { Banner objB = new Banner(); PageId = Convert.ToInt32(ddlPage.SelectedValue); UserID = Convert.ToInt32(ddlUserType.SelectedValue); string PageName = ""; // PageName = GetPageLabelName(PageId, UserID); PageName = GetPageNameForSequence(PageId, UserID); int DefaultBannId = 0; int DefaultCouponBannId = 0; for (int j = 0; j <= GrdBaner.Rows.Count - 1; j++) { Label lblBannerId5 = (Label)GrdBaner.Rows[j].FindControl("lblBannerId"); RadioButton radioDefault = (RadioButton)GrdBaner.Rows[j].FindControl("rdoDefaultBanner"); CheckBox chkDefaultCoupon = (CheckBox)GrdBaner.Rows[j].FindControl("chkDefaultCoupon"); if (chkDefaultCoupon.Checked == true) { DefaultCouponBannId = Convert.ToInt32(lblBannerId5.Text.ToString()); } if (radioDefault.Checked == true) { DefaultBannId = Convert.ToInt32(lblBannerId5.Text.ToString()); } } objB.DeleteDefaultCopon(PageId, UserID); objB.InsertInDefaultCopon(DefaultCouponBannId, PageId, UserID); //delete previous Banner and insert New Banner in defaultBanner table objB.DeleteDefaultBanner(PageId, UserID); objB.InsertInDefaultBanner(DefaultBannId, PageId, UserID); objB.DeletePreviousSetBanner(PageId, UserID); DeleteFromXml(PageName); DataSet dsDefault = new DataSet(); DataSet dsDef = new DataSet(); dsDefault = objB.GetoneDefaultBanner(PageId, UserID); if (dsDefault.Tables[0].Rows.Count > 0) { dsDef = objB.GetBannerImageNameandpath(Convert.ToInt32(dsDefault.Tables[0].Rows[0]["BannerId"].ToString())); } string DefImageName2 = ""; string Defvirtualpath2 = ""; if (dsDef.Tables[0].Rows.Count > 0) { DefImageName2 = dsDef.Tables[0].Rows[0]["BannerName"].ToString(); Defvirtualpath2 = dsDef.Tables[0].Rows[0]["BannerPath"].ToString(); } AddBannerToXml(Defvirtualpath2, DefImageName2, DefImageName2, PageName); SuccesfullMessage("Default Banner set successfully."); }