This question is locked. New answers and comments are not allowed.
I have tried using a client side event and a form post from within my content but both of them don't work. What is the correct way to do this? This window shares the same model as the parent page. I want to take the model from the parent and the model from the child window and post them to my controller. Below are the main bits I am using. I have excluded most of the parent stuff. The excludeBtn opens the window from the parent.
<script type="text/javascript"> //button on the parent form that opens the window $('#excludeBtn').click(function (e) { e.preventDefault(); ShowPopupWindow("Edit Exclusion Indicator", "/W2Generation/EditFileInclusionIndicator"); });//gets the data from the parent telerik grid and builds a string function GetUserSelections() { var collector = $("#parentCollector").val(); var fileYear = $("#fileYear").val(); var selectedServiceLevel = $("#serviceLevel").val(); var selectedFilingMethod = $("#filingMethod").val(); var companies = ""; $("#CompanyListingGrid .chkBoxSelected").each(function () { if ($(this).is(":checked")) { companies += $(this).attr('value') + '|'; } }); companies = companies.slice(0, -1); var inputModel = { "SelectedCollector": collector, "SelectedFilingYear": fileYear, "SelectedServiceLevel": selectedServiceLevel, "SelectedFilingMethod": selectedFilingMethod, "SelectedCompanies": companies }; return inputModel; }//opens window function ShowPopupWindow(title, source) { var window = $('#popupWindow').data('tWindow'); window.title(title); window.center().open(); }//tried this on window close function SubmitToController() { var jsonData = GetUserSelections(); $.ajax({ url: '/W2Generation/UpdateFileInclusionIndicator', type: "POST", data: jsonData, contentType: "application/json; charset=utf-8", dataType: "json" }); }</script>{ Html.Telerik().Window() .Name("popupWindow") .Modal(true) .Width(400) .Height(200) .Buttons(buttons => buttons.Close()) .ClientEvents(clientEvents => clientEvents.OnClose("SubmitToController")) //trying to use this or the content post .Draggable(false) .Visible(false) .Content(@<text> @using (Html.BeginForm("UpdateFileInclusionIndicator", "W2Generation", FormMethod.Post)) { @Html.ValidationSummary(true) <fieldset> <div class="editor-label"> @Html.Label("Exclude the selected companies from the current tax filing: ") </div> <br/> <div class="editor-field"> @Html.RadioButtonFor(model => model.IncludeInFiling, false, new { id = "IncludeInFiling_false" }) <label for="IncludeInFiling_false">Yes</label> @Html.RadioButtonFor(model => model.IncludeInFiling, true, new { id = "IncludeInFiling_true" }) <label for="IncludeInFiling_true">No</label> </div> </fieldset> <div> <button type="submit" id="submit" value="">Save</button> </div> } </text>) .Render(); }