[CLOSED] Window Autoload

  1. #1

    [CLOSED] Window Autoload

    The code below was working just fine in Rev 3919, but after jumping to 3930 the parameter is always null.

    Below is the javascript code called after I press the Inactivate button.

            // Show the user inactivation confirmation popup passing the currently selected userIds values as URL parameters.
            function showInactivateUsersPopup() {
    
                #{UserPopup}.title = 'Inactivate User(s)';
                #{UserPopup}.show();
                // The Inactivate User window is an autoload iFrame, meaning it is a full page (not just a control).
                // In order to get all of the selected userIds to it, the most straightforward solution is to
                // rewrite the url with a "Ids" param whose value is a comma-seperated list of userIds.
                #{UserPopup}.load({
                   url: './UserInactivate.aspx',
                   params: {Ids: getSelectedRecordIds(#{ActiveUsersGridPanel}.getSelectionModel()).join(',') },
                   scripts: true,
                   discardUrl: true,
                   nocache: true
                 });
            }
    
            // Returns the user ID for each record currently selected in the grid.
            function getSelectedRecordIds(selectionModel) {
                return Ext.Array.pluck(Ext.Array.pluck (selectionModel.getSelection(), 'data'), 'UserId');
            }
    The window definition used as a popup.

      <%-- Add a default URL so I don't receive a 'No URL specified' the first time the window is shown --%>
      <ext:Window ID="UserPopup" runat="server" Resizable="false" Closable="true" Hidden="true">
         <Loader runat="server" Mode="Frame" DisableCaching="true" Url="./UserInactivate.aspx?Ids=0">
            <LoadMask ShowMask="true" />
         </Loader>
      </ext:Window>
    The UserInactivate.aspx page, but Request.Params["Ids"] is now returning null.

        public partial class UserInactivate : System.Web.UI.Page
        {
            private List<int> userIds;
    
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
    
                userIds = Request.Params["Ids"]
                            .Split(',')
                            .Select(ea => String.IsNullOrEmpty(ea) ? 0 : Convert.ToInt32(ea))
                            .ToList();
            }
    
            protected void Page_Load(object sender, EventArgs e)
            {
                Message.Html = String.Format("<b><u>{0}</u></b> {1} been selected to be inactivated.", 
                                                userIds.Count(), 
                                                (userIds.Count() == 1) ? "user has" : "users have");
    
            }
        }
    Last edited by geoffrey.mcgill; Apr 11, 2012 at 12:00 AM. Reason: [CLOSED]
  2. #2
    Ok, I had a brain freeze. Please close or delete this thread because everything works. The context menu button was not configured correctly, but the toolbar menu button was. Oops, my mistake.
  3. #3
    Quote Originally Posted by cwolcott View Post
    Ok, I had a brain freeze. Please close or delete this thread because everything works. The context menu button was not configured correctly, but the toolbar menu button was. Oops, my mistake.
    No worries. Happy to hear it's working.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] window autoload client side
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 17, 2012, 2:28 PM
  2. AutoLoad Window Issue
    By khadga in forum 1.x Help
    Replies: 2
    Last Post: Apr 21, 2011, 1:45 PM
  3. MVC Window-AutoLoad-ShowMask Bug?
    By fondant in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 30, 2009, 10:09 PM
  4. [CLOSED] Window AutoLoad Params
    By rcaunt in forum 1.x Legacy Premium Help
    Replies: 19
    Last Post: Sep 09, 2009, 4:05 PM
  5. [CLOSED] Panel + AutoLoad + Window
    By state in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 15, 2009, 7:33 AM

Posting Permissions