Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying show a jQuery modal popup when error occurred in controller and display a same view where controller trying return.


How can we do that?

 HttpPost
 Function Traitement(model As TraitementViewModel) As ActionResult
     Dim exception As Exception = Nothing
    ...

     Catch ex As Exception
         Exception = ex
     End Try
     If (exception IsNot Nothing) Then
         Return PartialView("Errors", Statics.GetErreursForException(exception))
     End If
End Function


What I have tried:

partial View "Errors"
<pre>@ModelType IEnumerable(Of String)
<div>
 <hr />
        <h2>Les erreurs suivantes se sont produites</h2>
        <ul>
            @code
                For Each msg As String In Model
                @<li>
                    @msg
                </li>
                Next
            End Code
        </ul>
    </div>
Posted
Updated 12-Jan-17 17:08pm
v2

1 solution

a jQuery modal is a client-side control. You may need to use AJAX to retrieve the server error details and diplay them in the modal as you would want. Here's an example: Show error messages in a modal pop up from an MVC controller[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900