I have a Kendo().Button on a page that, when clicked, fires a click event to open a Kendo().Window in order to display an alert. This works fine. But, if I add a $(document).ready function to open the window when the document is ready, it does not open the window, and the button does not render properly.
Instead of rendering as a <button> with an <img> property, instead it renders as a plain <button> no image,
Code follows:
Instead of rendering as a <button> with an <img> property, instead it renders as a plain <button> no image,
Code follows:
@{ if (@Model.IsClinicalAlert) { @(Html.Kendo().Button() .Name("redalertbutton") .ImageUrl(Url.Content("~/img/patient_alert_red.bmp")) .HtmlAttributes(new { type = "button" }) .Events(ev => ev.Click("onAlertClick"))) } else { @(Html.Kendo().Button() .Name("greenalertbutton") .ImageUrl(Url.Content("~/img/patient_alert_green.bmp")) .HtmlAttributes(new { type = "button" }) .Events(ev => ev.Click("onAlertClick"))) } }<script> $(document).ready(function () { if ($@Model.IsClinicalAlert) { alert(@Model.ClinicalAlert); var wdw = $("#alertWindow").data("kendoWindow"); wdw.open(); } }); function onAlertClick(e) { var wdw = $("#alertWindow").data("kendoWindow"); wdw.open(); }</script>@(Html.Kendo().Window() .Name("alertWindow") .Title("Clinical Alert") .Content(@<text><strong>@Model.ClinicalAlert</strong></text>) .Draggable() .Resizable() .Width(400) .Modal(true) .Visible(false) .Position(settings => settings.Top(150).Left(250)))