Apr 10, 2012, 10:26 PM
[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.
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 10, 2012 at 11:00 PM.
Reason: [CLOSED]