Problems with ModelState.IsValid in a UmbracoPage with params
Hi,
I have some problems when I validate the Model in a page managed by your package.
This is the scenario.
I have an umbraco page with 3 parameters (umbracoParam) - The node url is Admin.
In a sub virtual page I need to create a form to modify a product (URL: "Admin/home/bath/1000 - where home, bath and productId are the parameters).
Now I need to validate the form...but when the Model is invalid I cannot return on current page with params and modified model data.
I tried with no result with:
return CurrentUmbracoPage();
return RedirectToCurrentUmbracoUrl();
return RedirectToCurrentUmbracoPage();
Usually with forms I used "return CurrentUmbracoPage();", but in this case I return on the Umbraco Page "Admin" without the params.
How can I solve this problem?
Have you realize a custom method to do it?
Sadly there is nothing in AutoRouteTemplate that keeps the original Url (admin/home/bath/1000), so that you can redirect back to it when forms error.
You will have to roll your own solution. The best I can think of is saving the original Url to either a hidden text field in your form or use the Session (HttpContext.Session) object.
Problems with ModelState.IsValid in a UmbracoPage with params
Hi, I have some problems when I validate the Model in a page managed by your package. This is the scenario.
I have an umbraco page with 3 parameters (umbracoParam) - The node url is Admin. In a sub virtual page I need to create a form to modify a product (URL: "Admin/home/bath/1000 - where home, bath and productId are the parameters).
Now I need to validate the form...but when the Model is invalid I cannot return on current page with params and modified model data.
I tried with no result with:
Usually with forms I used "return CurrentUmbracoPage();", but in this case I return on the Umbraco Page "Admin" without the params.
How can I solve this problem? Have you realize a custom method to do it?
Thank you in advance. Adriano
Hi Adriano
Sadly there is nothing in AutoRouteTemplate that keeps the original Url (admin/home/bath/1000), so that you can redirect back to it when forms error.
You will have to roll your own solution. The best I can think of is saving the original Url to either a hidden text field in your form or use the Session (HttpContext.Session) object.
Cheers
Jonathan
is working on a reply...