Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9275375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:34:30+00:00 2026-06-18T16:34:30+00:00

I have a page with a checkbox that the user is supposed to check

  • 0

I have a page with a checkbox that the user is supposed to check and a popped up window will display. The popped up window displays correctly; however, I have not been able to get the window to close. As you can see below, the closewindow function is being called whenever the user clicks on submit. The message is displayed, but the window never closes. See sample code below.

//This is the content of the partial page that is being load in the popped up window.
@using (Html.BeginForm("StudentArchive", "Arvhive", FormMethod.Post, new { onsubmit = "CloseWindow()" }))
{

    @Html.HiddenFor(item => item.StudentID)
<table>
    <tr>
        <th>
            Student Archive Reason
        </th>
    </tr>
    <tr>
        <td>
            @Html.TextAreaFor(item => item.ArchiveReason)
        </td>
    </tr>
</table>

 <input type="submit" value="Submit" name="btnSubmit" id="ArchiveReasonSubmit" onclick="CloseWindow();" />
}


      <script type="text/javascript">
          function CloseWindow() {
              alert('I am closing window in reason for archive');
              $("#Window").data("tWindow").close();
//              $('#Window').prop("checked", "checked");
//              window.location.href = window.location.href;
          }
    </script>



//this script is in a studentDetails page which is where the checkbox that would open the window below located.



<script type="text/javascript">
    function chkArchive() {
        var s = document.getElementById('archiveCheckBox').checked;
        if (s == true) {
            OpenWindow(this);
        }

        if (s == false) {
            alert('checkbox is unchecked');
        }
    }
</script>


<script type="text/javascript">
        function OpenWindow(e) {
            var checkbox = document.getElementById('archiveCheckBox').value;
            if (checkbox == "false") {
                alert('It is false.');
            } else if (checkbox == "true") {
                $('#Window').data('tWindow').center().open();
            } 
        }
</script>

    <script type="text/javascript">
        function ClosingWindow() {
            $('#Window').prop("checked", "checked");
            window.location.href = window.location.href;
        }
    </script>


  @{Html.Telerik().Window()
  .Name("Window")
  .Visible(true)
  .Title("Reason for Archives")
  .Modal(true)
  .Height(600)
  .Draggable(true)
  .Visible(false)  //I could have added a variable set the default value to false to hide the window. However, I am not sure how to change it back to 
                   //yes after the user checks the checkbox for the first time. The only event that fire when a user check the checkbox is the javascript event to check the state
                   // of the checkbox and open the window.
  .Width(800)
  .ClientEvents(events => events.OnClose("ClosingWindow"))
  .LoadContentFrom(Url.Action("StudentArchive", "Student", new { StudentID = @ViewData["StudentID"] }, Request.Url.Scheme))
  .HtmlAttributes(new { onsubmit = "CloseWindow()" })
  .Render();
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:34:32+00:00Added an answer on June 18, 2026 at 4:34 pm

    The jquery library was being referenced twice. I removed it from the partial view page, and the query works fine. Here is the link that helps me solve the issue.:

    http://www.telerik.com/community/forums/aspnet-mvc/window/close-modal-window-from-within-the-window.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a checkbox when user checked that check box means. I need to
I have a web page that consists of a checkbox (parent) and on this
I have an aspx page that contains a checkbox, and a button. The button
We have an ASP.Net page that uses a checkbox to toggle between a list
I'm creating an admin page that displays a list of user registrations pending approval.
I have a page that shows a modal dialog onload. There's a checkbox that
I have a HTTP interface page that requires the user to upload various independent
I have a checkbox item on my page (note: this is not inside a
i've a php page with a form in which i have a checkbox that
I have list of checkboxes that has all checkbox pre-checked when page load. Firstly,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.