Pozdrav!
Molim za pomoć.
Ovo je model
Code:
namespace MuzickaProdavnica.EF
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
public partial class Obavestenja
{
public int Id { get; set; }
public Nullable<System.DateTime> DatumObjave { get; set; }
[Required(ErrorMessage = "!")]
public string Naslov { get; set; }
[Required(ErrorMessage = "!")]
[UIHint("tinymce_jquery_full"), AllowHtml]
public string Tekst { get; set; }
public string PutanjaDoFajla { get; set; }
public string Korisnik { get; set; }
public Nullable<int> Aktivan { get; set; }
}
}
Ovo je view
Code:
@model MuzickaProdavnica.EF.Obavestenja
@{
ViewBag.Title = "Test1111";
//Layout = "~/Views/Shared/_Layout.cshtml";
}
@Html.ValidationSummary(true, "Neuspešan unos obaveštenja!")
<div id="unos_obavestenja" style="display: none">
@using (Html.BeginForm("Unos", "Obavestenja", FormMethod.Post, new { id = "upisi", enctype = "multipart/form-data" }))
{
<fieldset id="fildset_unos">
<legend>Novo obaveštenje test</legend>
<div class="editor-label">
@Html.LabelFor(m => m.Naslov)
</div>
@Html.AntiForgeryToken()
<div class="editor-field">
@Html.TextBoxFor(m => m.Naslov )
@Html.ValidationMessageFor(m => m.Naslov)
</div>
@Html.AntiForgeryToken()
<div class="editor-label">
@Html.LabelFor(m => m.Tekst)
</div>
<div class="editor-field-text_unos">
@Html.EditorFor(model => model.Tekst,new { style = "width:800px; height: 300px; " })
@Html.ValidationMessageFor(m => m.Tekst)
</div>
<label for="file">Datoteka:</label>
<input type="file" name="fajl" />
</fieldset>
}
</div>
<script type="text/javascript">
$(document).on('focusin', function (e) {
if ($(event.target).closest(".mce-window").length) {
e.stopImmediatePropagation();
}
});
</script>
Dialog pozivam iz drugog Viewa
Code:
$('#EditBtn').live('click', function () {
$("#unos_obavestenja").dialog({
width: 800,
modal: true ,
buttons: {
"Upiši obaveštenje": function () {
$("#upisi").submit();
return true;
},
"Odustani": function () {
$(this).dialog("close");
}
},
});
});
Nikako ne uspevam da nateram TinyMCE da prihvati focus....