protected void btnSaveOglas_Click(object sender, EventArgs e) { using(PoslovniKlubBL temp = new PoslovniKlubBL()) { try { DateTime vrijedi = DateTime.ParseExact(txtCalendar.Text, "dd.MM.yyyy", CultureInfo.InvariantCulture); if (vrijedi > DateTime.Now) { int korID = Convert.ToInt32(ddlSporazumBroj.SelectedValue); int katID = Convert.ToInt32(ddlKategorija.SelectedValue); int podkatID = Convert.ToInt32(ddlPodKategorija.SelectedValue); int VrstaID = Convert.ToInt32(ddlVrstaOglasa.SelectedValue); //HttpUtility.HtmlEncode(txtOglas.Text).Replace("\r\n", "<br/>"); ovo sam stavio zbog exporta oglasa u 2 reda if (!string.IsNullOrWhiteSpace(txtNaslovOglasa.Text) && !string.IsNullOrWhiteSpace(txtOglas.Text) && korID > 0 && VrstaID > 0 && katID > 0 && podkatID > 0) { temp.SavePost(korID, txtNaslovOglasa.Text, VrstaID, katID, podkatID, vrijedi, txtOglas.Text); ResetFields(); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste unijeli/izabrali sve podatke!');", true); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Pogrešan datum!');", true); } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Niste unijeli/izabrali sve podatke!');", true); } } }