This question is locked. New answers and comments are not allowed.
Hi,
We are using Telerik MVC in one of our projects and trying to figure out how the controls can be used with this application. I need a pop-up modal and am using the code below. Within the pop-up window, I have two buttons "Save" and "Cancel". When the user clicks on the "Cancel" button, I should be able to close the pop-up window and refresh the parent page. When the user clicks on the "Save" button, I should be able to submit to the controller and also close the current pop-up window and refresh the parent page. What is the best way to implement this. For the "Cancel" button, onclick event, I have a javascript function:
Also, I wanted to find out that when I assign an event handler to the "Save" button on the pop-up window, .data(tWindow) is always "undefined". Please help!
SM
We are using Telerik MVC in one of our projects and trying to figure out how the controls can be used with this application. I need a pop-up modal and am using the code below. Within the pop-up window, I have two buttons "Save" and "Cancel". When the user clicks on the "Cancel" button, I should be able to close the pop-up window and refresh the parent page. When the user clicks on the "Save" button, I should be able to submit to the controller and also close the current pop-up window and refresh the parent page. What is the best way to implement this. For the "Cancel" button, onclick event, I have a javascript function:
function
closeWindow() {
var detailWindow = $('Detail').data('tWindow'
);
detailWindow.close();
return (false
);
}
but detailWindow is always null because .data('tWindow'); is null. Can anybody please help me with how I can implement both the "Save" and "Cancel" events.
<% Html.Telerik().Window() .Name("RelationshipDetail") .LoadContentFrom("http://localhost/Account/Relationship/Detail") .Buttons(buttons => buttons.Refresh().Maximize().Close()) .Draggable(true) .Scrollable(false) .Modal(true) .Title("Add New Relationship") .Width(1050) .Height(500) .Visible(false) .Render(); %>Also, I wanted to find out that when I assign an event handler to the "Save" button on the pop-up window, .data(tWindow) is always "undefined". Please help!
<% Html.Telerik().ScriptRegistrar()
.OnDocumentReady(() =>
{%>
$('#btnSave')
.bind('click',
function(e) {
var data = $(this).serialize() + "
&submitButton=Save";
alert("data:" + data);
$.post(this.action, data, function() {
$('#popupForm').closest('.t-window').data('tWindow').close();
});
e.preventDefault();
});
SM