locked
Dynamic Data Non-Fatal Warnings RRS feed

  • Question

  • User491136030 posted

    I am using Dynamic Data with Entity Framework 4.0.  I have been able to create business logic to validate my data using ValidationException.  This stops the user from going any further before they fix it.  Normally this is what I want but I do have some non-fatal warnings I would like to just display after the insert or update that doesn't prevent the insert or update.  Any insight?  Thanks.

    Friday, April 29, 2011 8:57 AM

Answers

  • User-330204900 posted

    no you would create a static extension method class and then use like this

    Page.SetPopupMessage("Message of some sort!");

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2011 5:01 PM

All replies

  • User-330204900 posted

    Hi Sandy, you say

    I do have some non-fatal warnings I would like to just display after the insert or update that doesn't prevent the insert or update.
    do you mean after the insert/update of the DB for the record or do you mean the after they have made a change to a single field?

    Sunday, May 1, 2011 12:53 PM
  • User491136030 posted

    For my current issue I want the warning to display after the insert or update of the DB. It would be nice to know how to do it after a single field change as well.  Thanks for your reply.

    Tuesday, May 3, 2011 10:04 AM
  • User-330204900 posted
    /// <summary>
    /// Sets the pop-up message.
    /// </summary>
    /// <param name="page">The page.</param>
    /// <param name="message">The message.</param>
    /// <remarks></remarks>
    public static void SetPopupMessage(this Page page, String message)
    {
        var csm = page.ClientScript;
        var script = String.Format("window.onload = function () {{ alert('{0}');}}", message);
        csm.RegisterStartupScript(page.GetType(), "NAC_alert", script, true);
    }

    this will creat a popup dialog with the message in it. Alternativly I have also used a Literal on the page to inject warning messages.

    Wednesday, May 4, 2011 1:19 PM
  • User491136030 posted

    I assume I would put this method in my List.aspx page?  How do I get my business rule message from the entity partial class to the SetPopupMessage method?

    Wednesday, May 4, 2011 2:29 PM
  • User-330204900 posted

    no you would create a static extension method class and then use like this

    Page.SetPopupMessage("Message of some sort!");

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2011 5:01 PM