locked
Validation Message RRS feed

  • Question

  • User-371148474 posted

    Hello,

    I have this page that contains a form, when users are done with the form,on IsPost,if successful, they get a validation message, but I need to redirect after the request.. How do I transfer the validation message to a new page....cos they shouldn't stay on the same page if Request is not null..

    Help Please...

    Sunday, July 20, 2014 8:55 AM

Answers

  • User1713851783 posted

    There are a lot of ways to pass data from a page to another; for a comprehensive coverage look at Transferring Data Between ASP.NET Web Pages.

    In your case I think that the best solution could be session variables. In the page with the form, if IsPost is successful, you should place this snippet:

    Session["message"] = validationMessage;
    Response.Redirect("yourDestinationPage");
    

    and in yourDestinationPage something like:

    @if(!string.IsNullOrEmpty((string)Session["message"])){
        <p>@Session["message"]</p>
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 20, 2014 12:34 PM