public void AdvertiseInsert() { advBLLObj.Name = txtAddName.Text; advBLLObj.ValidFrom = Convert.ToDateTime(txtValidFrom.Text).ToString(); advBLLObj.ValidTo = Convert.ToDateTime(txtValidTo.Text).ToString(); advBLLObj.Active = ddlStatus.SelectedItem.Text; advBLLObj.Type = ddlType.SelectedItem.Text; GetImagePath(); if (flag == false) { int j = 0; j = advBLLObj.BLLAdvertiseInsert(advBLLObj); if (j == 0) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Not added')", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert(' Added')", true); FillAdvGrid(); } } else { int j = 0; advBLLObj.AdvId = Convert.ToString(ViewState["advId"]); j = advBLLObj.BLLAdvertiseUpdate(advBLLObj); if (j == 0) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Not Updated')", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Updated Successfully..')", true); FillAdvGrid(); flag = false; } } }