Items in Tabs not being initialised - how to tell if they are initialised ?

  1. #1

    Items in Tabs not being initialised - how to tell if they are initialised ?

    Hi,
    I've got a set of tabs containing various controls. During tab setup controls values are set. When a user presses a "Save" button I'm trying to collect the values from the controls on all the tabs and those where the Tab hasn't been viewed are not returning values. I've tried setting DeferredRender="false" but that doesn't fix the problem.

    Is there a way to determine whether controls have been setup (in the save function) - so I can know whether the values controls return are accurate ?

    Thanks
    Rich
  2. #2
    Can you post example of your code?
  3. #3

    Example

    Hi,

    I've cut down the existing code lots - some of the problems disappear - this is the simplest I could get that shows some symptoms.

    The example has Nested Tabs - navigating to Tab "333" then pressing the "Save Button" on Sub-Tab "AA" gives cb1=AR and cb2="" - if you then go to Sub-Tab="BB" the combo-box has a value - returning to Sub-Tab "AA" and pressing save gives cb1=AR and cb2=Alaska

    I've tried DeferredRender="false"
    Any suggestions please ?

    thanks
    rich.



    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestTabs1.aspx.cs" Inherits="WebApplication1.TestTabs1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    var store1 = this.Store1;
    
    store1.DataSource = new object[]
    {
    new object[] { "AL", "Alabama", "The Heart of Dixie" },
    new object[] { "AK", "Alaska", "The Land of the Midnight Sun" },
    new object[] { "AZ", "Arizona", "The Grand Canyon State" },
    new object[] { "AR", "Arkansas", "The Natural State" },
    new object[] { "CA", "California", "The Golden State" },
    new object[] { "CO", "Colorado", "The Mountain State" },
    new object[] { "CT", "Connecticut", "The Constitution State" },
    };
    
    
    store1.DataBind();
    }
    
    
    </script>
    <script type="text/javascript">
    // IE9 - createContextFragment fix
    if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment) {
    Range.prototype.createContextualFragment = function (html) {
    var frag = document.createDocumentFragment(), div = document.createElement("div");
    frag.appendChild(div);
    div.outerHTML = html;
    return frag;
    };
    } 
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <ext:Store ID="Store1" runat="server">
    <Reader>
    <ext:ArrayReader>
    <Fields>
    <ext:RecordField Name="abbr" />
    <ext:RecordField Name="state" />
    <ext:RecordField Name="nick" />
    </Fields>
    </ext:ArrayReader>
    </Reader>
    </ext:Store>
    <ext:TabPanel runat="server" >
    <Items>
    <ext:Panel Title="11" runat="server" AutoHeight="true">
    <Items>
    <ext:Label runat="server" Text="hi" />
    </Items>
    </ext:Panel>
    
    <ext:Panel runat="server" AutoHeight="true" Title="333">
    <Items>
    
    <ext:TabPanel runat="server" DeferredRender="false" Title="22">
    <DirectEvents>
    <AfterLayout OnEvent="Tab1_panel_afterLayout" />
    </DirectEvents>
    <Items>
    
    <ext:Panel runat="server" Title="AA" AutoHeight="true">
    <Items>
    <ext:Button ID="SaveBtn" runat="server" Text="Save">
    <DirectEvents>
    <Click OnEvent="SaveBtn_onClick">
    <EventMask ShowMask="true" />
    </Click>
    </DirectEvents>
    </ext:Button>
    
    <ext:ComboBox runat="server" ID="cb1" StoreID="Store1" DisplayField="abbr" ValueField="abbr"
    Mode="Local" />
    
    </Items>
    </ext:Panel>
    
    <ext:Panel ID="Panel1" runat="server" Title="BB" AutoHeight="true">
    <Items>
    <ext:ComboBox runat="server" ID="cb2" StoreID="Store1" DisplayField="state" ValueField="state"
    Mode="Local" />
    </Items>
    </ext:Panel>
    </Items>
    </ext:TabPanel>
    </Items>
    </ext:Panel>
    </Items>
    </ext:TabPanel>
    </div>
    </form>
    </body>
    </html>
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    namespace WebApplication1
    {
        public partial class TestTabs1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
            }
    
            [DirectMethod]
            public void Tab1_panel_afterLayout(object sender, DirectEventArgs e)
            {
                this.cb1.SetValueAndFireSelect("AR");
                this.cb2.SetValueAndFireSelect("Alaska");
            }
    
            [DirectMethod]
            public void SaveBtn_onClick(object sender, DirectEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("cb1=" + this.cb1.SelectedItem.Text);
                System.Diagnostics.Debug.WriteLine("cb2=" + this.cb2.SelectedItem.Text);
            }
    
        }
    }
  4. #4
    Thank you for your example. Add to the first TabPanel attribute DefferedRender="False". Now it works fine.

    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
        	var store1 = this.Store1;
    
        	store1.DataSource = new object[]
        	                    	{
        	                    		new object[] {"AL", "Alabama", "The Heart of Dixie"},
        	                    		new object[] {"AK", "Alaska", "The Land of the Midnight Sun"},
        	                    		new object[] {"AZ", "Arizona", "The Grand Canyon State"},
        	                    		new object[] {"AR", "Arkansas", "The Natural State"},
        	                    		new object[] {"CA", "California", "The Golden State"},
        	                    		new object[] {"CO", "Colorado", "The Mountain State"},
        	                    		new object[] {"CT", "Connecticut", "The Constitution State"},
        	                    	};
    
    
        	store1.DataBind();
        }
    
        [DirectMethod]
        public void Tab1_panel_afterLayout(object sender, DirectEventArgs e) {
            this.cb1.SetValueAndFireSelect("AR");
            this.cb2.SetValueAndFireSelect("Alaska");
        }
    
        [DirectMethod]
        public void SaveBtn_onClick(object sender, DirectEventArgs e) {
            System.Diagnostics.Debug.WriteLine("cb1=" + this.cb1.SelectedItem.Text);
            System.Diagnostics.Debug.WriteLine("cb2=" + this.cb2.SelectedItem.Text);
        }
    
    
    	</script>
    <script type="text/javascript">
        // IE9 - createContextFragment fix
        if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment) {
            Range.prototype.createContextualFragment = function (html) {
                var frag = document.createDocumentFragment(), div = document.createElement("div");
                frag.appendChild(div);
                div.outerHTML = html;
                return frag;
            };
        }
    </script>
    <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" />
        <div>
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:ArrayReader>
                        <Fields>
                            <ext:RecordField Name="abbr" />
                            <ext:RecordField Name="state" />
                            <ext:RecordField Name="nick" />
                        </Fields>
                    </ext:ArrayReader>
                </Reader>
            </ext:Store>
            <ext:TabPanel runat="server" DeferredRender="False">
                <Items>
                    <ext:Panel Title="11" runat="server" AutoHeight="true">
                        <Items>
                            <ext:Label runat="server" Text="hi" />
                        </Items>
                    </ext:Panel>
                    <ext:Panel runat="server" AutoHeight="true" Title="333">
                        <Items>
                            <ext:TabPanel runat="server" DeferredRender="false" Title="22">
                                <DirectEvents>
                                    <AfterLayout OnEvent="Tab1_panel_afterLayout" />
                                </DirectEvents>
                                <Items>
                                    <ext:Panel runat="server" Title="AA" AutoHeight="true">
                                        <Items>
                                            <ext:Button ID="SaveBtn" runat="server" Text="Save">
                                                <DirectEvents>
                                                    <Click OnEvent="SaveBtn_onClick">
                                                        <EventMask ShowMask="true" />
                                                    </Click>
                                                </DirectEvents>
                                            </ext:Button>
                                            <ext:ComboBox runat="server" ID="cb1" StoreID="Store1" DisplayField="abbr" ValueField="abbr"
                                                Mode="Local" />
                                        </Items>
                                    </ext:Panel>
                                    <ext:Panel ID="Panel1" runat="server" Title="BB" AutoHeight="true">
                                        <Items>
                                            <ext:ComboBox runat="server" ID="cb2" StoreID="Store1" DisplayField="state" ValueField="state"
                                                Mode="Local" />
                                        </Items>
                                    </ext:Panel>
                                </Items>
                            </ext:TabPanel>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:TabPanel>
        </div>
        </form>
    </body>
    </html>
  5. #5
    thanks
    rich

Similar Threads

  1. [CLOSED] Move tabs Tabs Style Google Chrome
    By majunior in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 30, 2013, 12:58 PM
  2. Replies: 10
    Last Post: May 19, 2011, 7:43 AM
  3. Replies: 1
    Last Post: Dec 06, 2010, 8:51 AM
  4. [CLOSED] [1.0] Tabstrip with dynamicly created items - items.count always 0
    By klaus.schwarz in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 07, 2010, 11:40 AM
  5. Replies: 0
    Last Post: Feb 01, 2010, 12:42 PM

Tags for this Thread

Posting Permissions