May 19, 2011, 7:59 AM
[CLOSED] Layout School Part III: Why doesnt the UserControl show up
So, I am slowly building up my questions and examples towards my live project. This is a continuation of Part I and Part II of my "Layout school", so the examples below builds on answers and discussions in the previous ones.
In this example I have the following structure:
ASPX:
I have played around with different Layouts and also replacing ViewPort in the USerControl with Panel, no difference really.
Once again, thanks for looking at this.
ASPX:
In this example I have the following structure:
ASPX:
<ext:Viewport>
<ext:Panel>
<ext:ComboBox>
</ext:Panel>
<ext:Panel>
<CP:MyCustomUserControl>
</ext:Panel>
</ext:ViewPort>
MyCustomUserControl has the following structure:<ext:Viewport>
<ext:FormPanel>
<ext:FieldSet>...</ext:FieldSet>
</ext:FormPanel>
<ext:TabPanel>
<ext:Panel>
<ext:GridPanel>
</ext:Panel>
<ext:Panel>
<ext:GridPanel>
</ext:Panel>
</ext:TabPanel>
</ext:ViewPort>
Below is the code in full. The problem is that MyUserControl doesnt seem to show up at all and I dont really understand why. If I replace the <CP:MyCustomUserControl> with the entire TabPanel from the UserControl, then the TabPanel shows up. However, if I use the structure above but remove the FormPanel from the UserControl (ie the only thing that exists in the UserControl is <viewPort><tabPanel>) then it doesnt work either.I have played around with different Layouts and also replacing ViewPort in the USerControl with Panel, no difference really.
Once again, thanks for looking at this.
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default3.aspx.cs" Inherits="WebApplicationExtNetTest.Test.Default3" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register TagPrefix="CP" TagName="MyUserControl" Src="MyUserControl.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="test1" />
<ext:RecordField Name="test2" />
<ext:RecordField Name="test3" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:Panel ID="Panel1" runat="server" Height="55" Layout="FitLayout">
<Items>
<ext:ComboBox ID="ComboBox1" runat="server" EmptyText="TestComboBox" Icon="User" DisplayField="CustomerName" ValueField="CustomerId" >
<Items>
<ext:ListItem Text="Test 1" Value="1" />
<ext:ListItem Text="Test 2" Value="2" />
<ext:ListItem Text="Test 3" Value="3" />
<ext:ListItem Text="Test 4" Value="4" />
</Items>
</ext:ComboBox>
</Items>
<BottomBar>
<ext:Toolbar ID="Toolbar3" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Icon="Add" Text="Create"></ext:Button>
<ext:ToolbarFill ID="ToolbarFill2" runat="server" />
<ext:Button ID="Button2" runat="server" Icon="ArrowRefresh" Text="Refresh"></ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server" Layout="FitLayout" Flex="1">
<Content>
<CP:MyUserControl runat="server" />
</Content>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
ASCX:<%@ Control Language="C#" ClassName="MyUserControl" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:ViewPort ID="ViewPort1" runat="server" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Stretch" />
</LayoutConfig>
<Items>
<ext:FormPanel ID="Customer_FormPanel_Customer1" runat="server" Layout="FitLayout" Flex="1" Title="Info" Header="true" Padding="5">
<BottomBar runat="server">
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="btnSave" Icon="Disk" Text="Save" runat="server" ></ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
<Items>
<ext:FieldSet ID="FieldSet1" runat="server" Title="Many fields" Layout="Form">
<Items>
<ext:CompositeField ID="CompositeField_Customer8" runat="server" FieldLabel="One fields" AnchorHorizontal="100%">
<Items>
<ext:NumberField ID="test1" runat="server" Width="90"/>
<ext:TextField ID="test2" runat="server" Width="40" ReadOnly="true"/>
</Items>
</ext:CompositeField>
</Items>
</ext:FieldSet>
</Items>
</ext:FormPanel>
<ext:TabPanel ID="TabPanel1" runat="server" Flex="1">
<Items>
<ext:Panel ID="PanelL" runat="server" Title="L" Layout="FitLayout" Border="true">
<Items>
<ext:GridPanel ID="GridPanel_Customer1" runat="server"
StripeRows="true"
Header="true"
Border="true"
AutoExpandColumn="Name">
<Store>
<ext:Store ID="StoreCL" runat="server" AutoDataBind="true" AutoLoad="true" IDMode="Explicit">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="Id" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="ParentId" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<TopBar>
<ext:Toolbar ID="ToolbarC2" runat="server">
<Items>
<ext:Button ID="ButtonL" runat="server" Icon="Add" Text="Create new"></ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="ColumnModelC3" runat="server" >
<Columns>
<ext:Column ColumnID="Id" Header="ID" DataIndex="Id" Hidden="true" />
<ext:Column DataIndex="Name" Header="Namn" />
</Columns>
</ColumnModel>
</ext:GridPanel>
</Items>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server" Title="TEst test" Layout="FitLayout" Flex="1">
<Items>
<ext:GridPanel ID="GridPanelQ" runat="server"
StripeRows="true" Header="true" Border="true" AutoHeight="true"
AutoExpandColumn="Name">
<TopBar>
<ext:Toolbar ID="Toolbar2" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Icon="Add" Text="Create new">
</ext:Button>
<ext:ToolbarFill ID="ToolbarFill2" runat="server" />
<ext:Button ID="ButtonQ" runat="server" Icon="ArrowRefresh" Text="Refresh">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Store>
<ext:Store ID="StoreQ" runat="server" AutoDataBind="true" AutoLoad="true" IDMode="Explicit" >
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="Id" />
<ext:RecordField Name="Name" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server" >
<Columns>
<ext:Column ColumnID="Id" Header="ID" DataIndex="Id" Hidden="true" />
<ext:Column DataIndex="Name" Header="Name" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="4">
<Items>
<ext:Label ID="Label1" runat="server" Text="Size:" />
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
<ext:ComboBox ID="ComboBox1" runat="server" Width="80">
<Items>
<ext:ListItem Text="2" />
<ext:ListItem Text="4" />
<ext:ListItem Text="6" />
<ext:ListItem Text="8" />
<ext:ListItem Text="10" />
</Items>
<SelectedItem Value="4" />
</ext:ComboBox>
</Items>
</ext:PagingToolbar>
</BottomBar>
</ext:GridPanel>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:ViewPort>
Last edited by Daniil; May 20, 2011 at 10:25 AM.
Reason: [CLOSED]