I have a view user control that can post form. This control can be used on multiple views. If user enters invalid data i add errors to ModelState - as simple as that. The problem is that i don't know which view/actionresult to return since i don't know from where user post form. Ok, i can get urlreferer - but that does not look nice for me. Any idea?
From stackoverflow
-
Pass the info from your parent page to the controller.
<% RenderPartial("MyUserControl", new MyUserControlViewData() { // pass parent page info here for user control to redirect to such as Controller = "Home", Action = "Index" // or even better ParentPath = ((WebFormView)this.ViewContext.View).ViewPath });michal zygula : thanks - great answer...
0 comments:
Post a Comment