Notifications and Validation

  1. #1

    Notifications and Validation

    Is there any way to set the size of an Ext.Notification to fit the contents of the panel specified in the ContentEl property?

    I am trying to use an notification control to display the contents of my <asp:validationSummary> controls to the user but can not get it to display correctly as at design time I do not know how big the control needs to be.

    Thanks,

    N. Wheeler


  2. #2

    RE: Notifications and Validation

    Ok so I hacked a solution together that works (in FireFox, Safari, and Chrome):

    .aspx page
        <div id="notificationValidationSummary" class="x-hidden">
            <ext:Panel ID="Panel2" runat="server" Border="false" BodyStyle="background-color:transparent;">
                <Body>
                    <ext:FitLayout ID="fpnlNotificationValidationSummary" runat="server">
                        <ext:Panel ID="pnlNotificationValidationSummary" runat="server" Border="false" BodyStyle="padding:2px;text-align:left;background-color:transparent;"
                            AutoHeight="True">
                            <Body>
                                <asp:ValidationSummary ID="vsSbnInfo" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="SbnInfo" />
                                <asp:ValidationSummary ID="vsGetSbnInfo" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="GetSbnInfo" />
                                <asp:ValidationSummary ID="vsGetReplacedByInformation" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="GetReplacedByInformation" />
                                <asp:ValidationSummary ID="vsReplacedByInformation" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="ReplacedByInformation" />
                                <asp:ValidationSummary ID="vsInitalSave" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="InitalSave" />
                                <asp:ValidationSummary ID="vsApprovals" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="Approvals" />
                                <asp:ValidationSummary ID="vsAbbComplete" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="ABBComplete" />
                                <asp:ValidationSummary ID="vsDcComplete" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="DcComplete" />
                                <asp:ValidationSummary ID="vsPsComplete" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px;" ValidationGroup="PsComplete" />
                                <PCCNet:ValidationSummaryPlus ID="vsGeneralErrors" runat="server" OnPreRender="genericValidationSummary_PreRender"
                                    Style="position: relative; top: 0px; left: 0px; margin-top: 0px;" ValidationGroup="" />
                            </Body>
                        </ext:Panel>
                    </ext:FitLayout>
                </Body>
            </ext:Panel>
    In the .cs file for the page:
        protected void Page_PreRender(object sender, EventArgs e)
        {
    
            Page.Validate("nonexistantvalidation"); //Force a validation event on a non-existant validation group.
            // we only want to display this if the page is not valid.
            if (Page.IsPostBack &amp;&amp; Page.IsAsyncPostBack() &amp;&amp; Page.IsAsync &amp;&amp; !Page.IsValid)
            {
    
                WindowListeners listeners = new WindowListeners();
                listeners.BeforeRender.Handler = "this.setHeight(#{fpnlNotificationValidationSummary}.height + 50, null); this.setWidth(#{fpnlNotificationValidationSummary}.width, null);  ";
    
                Notification.Config config = new Notification.Config();
                config.PinEvent = "none";
                config.ContentEl = "notificationValidationSummary";
                config.AutoHide = false;
                config.Title = "<strong>The following problem(s) need to be addressed:</strong>";
                config.Closable = false;
                config.Draggable = true;
                config.Pinned = false;
                config.Resizable = true;
                config.Icon = Icon.Cancel;
                config.Listeners = listeners;
    
                Ext.Notification.Show(config);
    
            }
    
        }
    I am not sure if this the best way to do this but it seems to work (except on IE but my users will not be using it so I don't really care).

    Now if only the panel would stay in the bottom right-hand corner of the screen when scrolling...

Similar Threads

  1. [CLOSED] Show notifications without spaces between Notifications
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 20, 2012, 4:24 PM
  2. [CLOSED] [0.8.2] Notifications and js troubles.
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 20, 2010, 4:51 AM
  3. [CLOSED] [1.0] Notifications
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 23, 2009, 2:57 PM
  4. [CLOSED] Notifications events?
    By state in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 29, 2009, 12:17 AM
  5. [CLOSED] Notifications
    By state in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 27, 2009, 3:14 PM

Posting Permissions