Wizard next save temporary result

1 Answer 483 Views
Wizard
Frans
Top achievements
Rank 1
Veteran
Iron
Frans asked on 29 Jun 2021, 01:50 PM

Hi,

How can I save the results of all steps when filling in all the Wizard steps ?  (in Telerik Asp.Net MVC Wizard control)

Lets say that step 2 is dependant on step 1 (screen should be rendedered with/without certain controls dependant of what was filled in on step 1.

How can I achieve this ?

Is there a serverside 'Next' click event or so ? Or a Select step event or so ?  I havent seen it to my dissapointing surprise.

(I know I can load content tabs with Ajax, but that doesnt give me the entered data.)

Martin

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 02 Jul 2021, 07:52 AM

Hi Martin,

Our MVC components, the Wizard included, do not have server-side events. If you want to send data from the current step to the server consider doing that with an AJAX request. You can attach a click handler to the "Next" button of the step:

.Buttons(b =>
{
	b.Next().Click("onFirstStepComplete");
});

Then in the handler you can use the Wizard's API to access the form data on the respective step and send this data with an AJAX request:

function onFirstStepComplete(e) {
	//access the first step by index and its form data
	var model = $("#wizard").data("kendoWizard").steps()[0].form._model;

	//trigger an ajax request and pass the data you need as parameters
	$.ajax({
		type: "POST",
		url: '@Url.Action("ActionName", "ControllerName")',
		contentType: "application/json; charset=utf-8",
		data: {
			firstName: model.FirstName,
			email: model.Email,
			//... additional parameters if needed...
		},
		dataType: "json",
		success: function (response) {
			alert('success');
		},
		error: function () {
			alert('error');
		}
	});
}

Regards,
Ivan Danchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Wizard
Asked by
Frans
Top achievements
Rank 1
Veteran
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or