Feb 07, 2011, 9:33 AM
Best Way to AutoLoad Complex Pages
Hi,
I've been trying for a while now to implement a two-tier tab layout. I want a top row of tabs, which when click show a set of child tabs. These child tabs will each have a unique View that they should AutoLoad.
I've tried various ways to do this but basically the only way I can get this to work (fairly) reliably so far is with the LoadMode.IFrame.. I'd ideally like to use Merge so that things are unnecessarily reloaded.
Can you suggest a good way to do this?
Basically I do:
I've been trying for a while now to implement a two-tier tab layout. I want a top row of tabs, which when click show a set of child tabs. These child tabs will each have a unique View that they should AutoLoad.
I've tried various ways to do this but basically the only way I can get this to work (fairly) reliably so far is with the LoadMode.IFrame.. I'd ideally like to use Merge so that things are unnecessarily reloaded.
Can you suggest a good way to do this?
Basically I do:
protected void Page_Load(object sender, EventArgs e) {
foreach (var p in Model) {
Ext.Net.Panel tabParent = new Ext.Net.Panel {
Closable = false,
Title = p.Title,
TabTip = p.Tooltip,
ID = ("tab_parent_" + p.Id)
};
Ext.Net.TabPanel childPnl = new Ext.Net.TabPanel {
Closable = false,
ID = "tabPnlChild" + p.Id,
HideBorders = true,
Border = false,
Frame = false,
Header = false
};
foreach (var c in p.menu_item_children) {
Ext.Net.Panel tabChild = new Ext.Net.Panel {
Closable = false,
Title = c.Title,
TabTip = c.Tooltip,
ID = ("tab_tier2_" + c.Id),
IDMode = IDMode.Explicit,
Padding = 10,
Html = "(dynamic content will be loaded here)"
};
tabChild.AutoLoad.Url = c.Target;
tabChild.AutoLoad.Mode = LoadMode.IFrame;
tabChild.AutoLoad.ShowMask = true;
tabChild.AutoLoad.Scripts = true;
tabChild.AutoLoad.Params.Add(new Ext.Net.Parameter {
Name = "containerId",
Value = tabChild.ID,
Mode = ParameterMode.Value
});
childPnl.Items.Add(tabChild);
tabParent.Items.Add(childPnl);
tabPnlParent.Items.Add(tabParent);
}
}
}
This works, in the main. But on certain Views I get Ext undefined errors.. it's not very reliable doing it this way. These are ASPX view pages, not partial views. I have no preference which I use, so long as they load each time. Are there certain controls which clash when loading them like this? Is Merge mode the best way to do this?