Telerik Popup Modal Window Will not close

2 posts, 0 answers
  1. Mitch
    Mitch avatar
    5 posts
    Member since:
    Sep 2012

    Posted 22 Mar 2013 Link to this post

    I have a telerik popped up window. It opens fine; however, I am having an issue closing the window. 

    Here is the popup window:

             .Title("Student Window")
             .LoadContentFrom(Url.Action("AddReason", "Reason", new { id = reasonID }, Request.Url.Scheme))
             .ClientEvents(events => events
             //.Effects(fx => fx           
             //    .Zoom()           
             //    .Opacity())

    here is the reference for the javascript:
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/spin.min.js")" type="text/javascript"></script>

    Here is the JavaScript:
    function DoOpen(id) {
            var url = '@Url.Action("AddReason","Reason")';
            $.post(url, { id: id }, function (data) {
                var window = $('#Window').data('tWindow').center();
     //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.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";
    <script type="text/javascript">
        function CloseWindow() {
    //        alert($("#Window").closest('.t-window').data('#tWindow'));
    //        $("#Window").data("tWindow").close();
            $('#Window').prop("checked", "checked");
             window.location.href = window.location.href;
    @using (Html.BeginForm("AddReason", "Reason", FormMethod.Post))
            <div class="editor-field">
                .HtmlAttributes(new { style = "height:310px;", id = "AddAReason" })
                tools => tools
            <p style="text-align:center">
                <input type="submit" value="Reason" id="AddReasonID" onclick="CloseWindow()"/>

  2. Mitch
    Mitch avatar
    5 posts
    Member since:
    Sep 2012

    Posted 23 Mar 2013 Link to this post

    I tried this morning use the $('#Window').closet('.t-window').data('tWindow').close() with no help still.
Back to Top