Oct 16, 2014, 2:49 AM
[CLOSED] Show User Control during Page_Load
This is an odd question. I have a user control that I will potentially show/hide many times during the life of the page. So I add it to the page via ext:UserControlLoader and initially hide it. In one case I might want it shown right away when the page is loaded.
What am I overlooking?
ASPX File:
- Run the code and press the "Show UC Dialog" button. Everything looks fine.
- Uncomment the two lines in Page_Load and run the code and press the "Show UC Dialog" button. The dialog is shown initially, but the layout is ugly.
What am I overlooking?
ASPX File:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
//Window d = X.GetCmp<Window>("UcDialog");
//d.Show();
}
</script>
<head runat="server">
<title />
<style type="text/css">
/* Packs the indicatorIcon to the upper/right of a text field. */
.DialogForm .x-panel-body-default {
background: transparent;
padding: 5px 10px 0px;
}
</style>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Window
runat="server"
Title="Question"
Width="250"
Height="400"
Maximizable="true"
BodyBorder="0"
Icon="ApplicationTileVertical"
Layout="BorderLayout">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" Text="Show UC Dialog"
OnClientClick="#{UcDialog}.show();" />
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:UserControlLoader runat="server" ID="uclDialog" UserControlID="ucciDialog" Path="./UcDialog.ascx" />
</Items>
</ext:Window>
</body>
</html>
ASCX File:<%@ Control Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:Window ID="UcDialog" runat="server" ClientIDMode="static" Title="UC" Icon="UserGreen"
Width="400" Layout="FitLayout" Resizable="false" Modal="true" Border="False"
Constrain="true" Closable="false" Hidden="true" ActiveIndex="0">
<HtmlBin>
<script type="text/javascript">
function closeDialog() {
App.UcDialog.close();
}
</script>
</HtmlBin>
<Items>
<ext:FormPanel ID="UcForm" runat="server" ClientIDMode="Static"
DefaultAnchor="100%" DefaultButton="UcSubmitBtn" Cls="DialogForm">
<Items>
<ext:Label runat="server" Text="Please enter the following info." />
<ext:Container runat="server" Html="<hr/>" MarginSpec="0 0 5 0" />
<ext:TextField ID="UcField" runat="server" ClientIDMode="Static" AllowBlank="false"
FieldLabel="UC Field" TabIndex="1" />
</Items>
<Listeners>
<ValidityChange Handler="App.UcSubmitBtn.setDisabled(!valid);" />
</Listeners>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="UcSubmitBtn" runat="server" ClientIDMode="Static" Text="Submit" Icon="UserGo"
Disabled="true" OnClientClick="closeDialog" />
<ext:Button ID="UcCancelBtn" runat="server" ClientIDMode="Static" Text="Cancel"
Icon="BulletCross" OnClientClick="closeDialog" />
</Buttons>
<Listeners>
<Show Handler="App.UcForm.reset(); App.UcField.focus(); App.UcDialog.doLayout();" />
</Listeners>
</ext:Window>
Last edited by Daniil; Oct 16, 2014 at 3:34 PM.
Reason: [CLOSED]