Dec 03, 2008, 9:53 AM
[FIXED] [V0.7] Bug with resolving controls
Hello,
I hope this example and replication is clear enough; let me know if you need any further information.
The problem has to do with 2 controls using the same ID through user controls.
Example.aspx:
1. Load page
2. Click on "Tab 2"
3. Edit the value under column Value to "Word 2"
4. Notice JS error
Explanation; I've rigged the GridPanel to enable the btnSave on the bottom Toolbar AfterEdit but it appears to be trying to grab the btnSave from the other Tab. If you remove or rename the Button from the first Tab, this example works.
Thanks so much for your support.
Cheers,
Timothy
I hope this example and replication is clear enough; let me know if you need any further information.
The problem has to do with 2 controls using the same ID through user controls.
Example.aspx:
<%@ Page Language="C#" %>
<%@ Register Src="~/Example/Example.ascx" TagName="Grid" TagPrefix="Example" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Example Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" EnablePartialRendering="True" />
<ext:ScriptManager runat="server" StateProvider="PostBack" />
<ext:TabPanel ID="TabPanel1" runat="server" AutoPostBack="True" DeferredRender="True">
<Tabs>
<ext:Tab runat="server" Title="Tab 1">
<Body>
<ExtJS:Button ID="btnSave" runat="server" AutoPostBack="False" Text="Save" MinWidth="80" />
</Body>
</ext:Tab>
<ext:Tab runat="server" Title="Tab 2">
<Body>
<Example:Grid runat="server" />
</Body>
</ext:Tab>
</Tabs>
</ext:TabPanel>
</form>
</body>
</html>
Example.ascx:<%@ Control Language="C#" ClassName="Example" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Store1.DataSource = new object[] {
new object[] { "Timothy", "Cool" }
};
Store1.DataBind();
}
</script>
<ext:Store ID="Store1"
runat="server"
AutoLoad="False">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="Customer" />
<ext:RecordField Name="Value" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
<ext:GridPanel ID="GridPanel1"
runat="server"
StoreID="Store1"
AutoHeight="True"
AutoWidth="True">
<Listeners>
<AfterEdit Handler="#{btnSave}.enable()" />
</Listeners>
<ColumnModel>
<Columns>
<ext:Column ColumnID="Customer" DataIndex="Customer" Header="Customer" />
<ext:Column ColumnID="Value" DataIndex="Value" Header="Value">
<Editor>
<ext:ComboBox runat="server"
Editable="True">
<Items>
<ext:ListItem Text="Word" Value="Word" />
<ext:ListItem Text="Word 2" Value="Word 2" />
<ext:ListItem Text="Word 3" Value="Word 3" />
</Items>
</ext:ComboBox>
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
<BottomBar>
<ExtJS:Toolbar runat="server">
<Items>
<ExtJS:ToolbarButton ID="btnSave" runat="server" AutoPostBack="False" Disabled="True" StandOut="True" Text="Save" MinWidth="80" />
</Items>
</ExtJS:Toolbar>
</BottomBar>
</ext:GridPanel>
Replication steps:1. Load page
2. Click on "Tab 2"
3. Edit the value under column Value to "Word 2"
4. Notice JS error
Explanation; I've rigged the GridPanel to enable the btnSave on the bottom Toolbar AfterEdit but it appears to be trying to grab the btnSave from the other Tab. If you remove or rename the Button from the first Tab, this example works.
Thanks so much for your support.
Cheers,
Timothy