Note that there are some explanatory texts on larger screens.

plurals
  1. PO('#Window').data('tWindow').close()
    primarykey
    data
    text
    <p>I have a telerik popped up window. It opens fine; however, I am having an issue closing the window. If I add an alert to the javascript, alert("#Window") or alert($(this).closest('#Window')), it will display [object Object]. However, alter("#Window").data("tWindow") or alert($(this).closest('#Window').data('tWindow')) will display null. I've removed the jquery and javascript reference from either the parent or the child page, and it did not make any difference. Any kind of help would be greatly appreciated. See sample code below </p> <p>Here is the popup window:</p> <pre><code>@{Html.Telerik().Window() .Name("Window") .Title("Student Window") .LoadContentFrom(Url.Action("AddReason", "Reason", new { id = reasonID }, Request.Url.Scheme)) .ClientEvents(events =&gt; events .OnClose("ClosingWindow") ) .Draggable(false) .Scrollable(false) .Width(800) .Height(600) .Modal(true) .Visible(false) //.Effects(fx =&gt; fx // .Zoom() // .Opacity()) .Render(); } </code></pre> <p>Here is the JavaScript:</p> <pre><code> &lt;script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="@Url.Content("~/Scripts/spin.min.js")" type="text/javascript"&gt;&lt;/script&gt; function DoOpen(id) { var url = '@Url.Action("AddReason","Reason")'; $.post(url, { id: id }, function (data) { var window = $('#Window').data('tWindow').center(); window.content(data); window.open(); }); } //This javascript is in the main page //I did an alert. alert($('#Window')) and alert($('#Window').data('tWindow')) they both return null function ClosingWindow() { $('#Window').prop("checked", "checked"); $('#Window').data('tWindow').close(); window.location.href = window.location.href; } Here is the partial view : @model Student.Models.Reason @using Student.Example @{ ViewBag.Title = "Add Reason"; Layout = "~/Views/Shared/_PartialReason.cshtml"; } &lt;script type="text/javascript"&gt; function CloseWindow() { // alert($("#Window").closest('.t-window').data('#tWindow')); // $("#Window").data("tWindow").close(); $('#Window').prop("checked", "checked"); window.location.href = window.location.href; } &lt;/script&gt; @using (Html.BeginForm("AddReason", "Reason", FormMethod.Post)) { @Html.ValidationSummary(true) &lt;fieldset&gt; &lt;div class="editor-field"&gt; @(Html.Telerik().Editor() .Name("EncountersArchive") .HtmlAttributes(new { style = "height:310px;", id = "AddAReason" }) .Encode(true) .Tools( tools =&gt; tools .Clear() .Bold().Italic().Underline().Strikethrough().Subscript().Superscript().Separator() .FontName().FontSize() .FontColor().BackColor().Separator() .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull().Separator() .InsertUnorderedList().InsertOrderedList().Separator() .Indent().Outdent().Separator() )) &lt;/div&gt; &lt;p style="text-align:center"&gt; &lt;input type="submit" value="Reason" id="AddReasonID" onclick="CloseWindow()"/&gt; &lt;/p&gt; &lt;/fieldset&gt; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload