[CLOSED] V2.1 TabPanel and Refresh Help

  1. #1

    [CLOSED] V2.1 TabPanel and Refresh Help

    Hi, i have a formaPanel with Two TabPanel, my problem is then assign the value to combobox in the second panel, but not select the tabPanel two..

    1) Load the page and press the button "Load", the record is load in the form and assign the value "3" at comboox..
    If press save, the combobox.value is null...

    2)Load the page press the button "Load",the record is load in the form and assign the value "3" at comboox.. press the tabTwo.
    Now if press save, the combobox value is ok..

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ARWebRevolution.WebForm1" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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" Namespace="">
                </ext:ResourceManager>
                <ext:Store ID="StoreTrasporti" runat="server">
                    <Model>
                        <ext:Model ID="Model1" runat="server" IDProperty="TraId">
                            <Fields>
                                <ext:ModelField Name="TraId" />
                                <ext:ModelField Name="TraDes" />
                            </Fields>
                        </ext:Model>
                    </Model>
                    <Sorters>
                        <ext:DataSorter Property="TraDes" Direction="ASC" />
                    </Sorters>
                </ext:Store>
                <ext:Viewport ID="ViewportFornitori" runat="server" Layout="BorderLayout">
                    <Items>
                        <ext:FormPanel ID="FormPanelFornitore" runat="server" ButtonAlign="Right" Cls="formMargins"
                                       BodyPadding="5" Padding="3" Region="Center" DefaultButton="ButtonSave" Title="Fornitore..."
                                       Layout="FormLayout" AnchorVertical="100%" MinWidth="300">
                            <FieldDefaults LabelWidth="90" />
                            <Items>
                                <ext:TabPanel ID="TabPanelFornitori" runat="server"  Anchor="100% 100%">
                                    <Items>
                                        <ext:Panel ID="Panel1" runat="server" Title="Panel One" Padding="5" Layout="AnchorLayout">
                                            <Items>
                                                <ext:TextField ID="TextField1" runat="server" Name="TraDes"  Width="250">
                                                </ext:TextField>
                                            </Items>
                                        </ext:Panel>
                                        <ext:Panel ID="Panel2" runat="server" Title="Panel Two" Padding="5" Layout="AnchorLayout">
                                            <Items>
                                                <ext:ComboBox ID="ComboBoxTrasporto" runat="server" TypeAhead="true" AnchorHorizontal="100%"
                                                              StoreID="StoreTrasporti" QueryMode="Local" ForceSelection="false" TriggerAction="All"
                                                              FieldLabel="Trasporto" Name="TraId" DisplayField="TraDes" ValueField="TraId"
                                                              EmptyText="Seleziona un trasporto..." FieldStyle="text-transform:uppercase;">
                                                    <Triggers>
                                                        <ext:FieldTrigger Icon="Clear" Qtip="Rimuovi selezionato" />
                                                    </Triggers>
                                                    <Listeners>
                                                        <TriggerClick Handler="this.clearValue()" />
                                                    </Listeners>
                                                </ext:ComboBox>
                                            </Items>
                                        </ext:Panel>
                                    </Items>
                                    <BottomBar>
                                        <ext:Toolbar runat="server" ID="ToolBarFornitore">
                                            <Items>
                                                <ext:Button ID="ButtonNew" runat="server" Text="Load" Scale="Medium" Icon="Add"
                                                            ToolTip="Save" ToolTipType="Title">
                                                    <DirectEvents>
                                                        <Click OnEvent="Save" />
                                                    </DirectEvents>
                                                </ext:Button>
                                                 <ext:Button ID="ButtonSave" runat="server" Text="Salva" Scale="Medium"
                                                     Icon="Accept" ToolTip="Salva le modifiche apportate"
                                                    ToolTipType="Title" >
                                            <DirectEvents>
                                                <Click OnEvent="SaveFornitore" />
                                            </DirectEvents>
                                        </ext:Button>
                                            </Items>
                                        </ext:Toolbar>
                                    </BottomBar>
                                </ext:TabPanel>
                            </Items>
                        </ext:FormPanel>
                    </Items>
                </ext:Viewport>
            </form>
        </body>
    </html>
    using System;
    using System.Linq;
    using Ext.Net;
    
    namespace ARWebRevolution
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                StoreTrasporti.DataSource = Data;
                
            }
    
            private new System.Collections.Generic.List<object> Data
            {
                get
                {
                    return new System.Collections.Generic.List<object>
                {
                    new { TraId = "1", TraDes="Pisolo" },
                    new { TraId = "2", TraDes="Mammolo"},
                    new { TraId = "3", TraDes="Brontolo"}
                };
                }
            }
    
            protected void Save(object sender, DirectEventArgs e)
            {
    
                FormPanelFornitore.SetValues(new { TraId = "3", TraDes = "Brontolo" });
                ComboBoxTrasporto.Value = "3";            
               
    
            }
    
            protected void SaveFornitore(object sender, DirectEventArgs e)
            {
                ExtNet.MessageBox.Alert("Title","ComboBox.Value = " + ComboBoxTrasporto.Value).Show();
            }
        }
    }
    Thanks for any help

    Aurelio
    Last edited by Daniil; Aug 13, 2012 at 7:15 AM. Reason: [CLOSED]
  2. #2
    Hi,

    By default an inactive tab is not rendered before first activation. Respectively, a ComboBox is not rendered as well. Therefore, its value is not in POST before activating the second tab.

    To get all tabs to be rendered, please set up:
    DeferredRender="false"
    for the TabPanel.

    Though, sure, you will lose the TabPanel performance benefit, i.e. rendering tabs on the fly on first activation.

    You also can cause the second tab to be rendered programmatically calling
    TabPanel1.setActiveTab(1);
    P.S. Please note that you can place the code behind directly on ASPX page wrapping in:
    <script runat="server">
        //code behind
    </script>
    and leave only
    <%@ Page Language="C#" %>
    It would allow us to run your code samples without any changes from our side.
  3. #3
    Hi..Daniil

    Thanks for the help, i test the second option (rendered programmatically) and it's work OK...

    Set the second tab and set the first tab, it's work fine.

    Thanks

    Aurelio
  4. #4
    You also can set up
    TabPanel1.ActiveTabIndex = 1;
    from code behind or in markup
    ActiveTabIndex = "1"
  5. #5
    HI..Daniil

    Yes the code, "TabPanel1.ActiveTabIndex = 1" work ok

    But the open a window and select the record for the grid, i need to the activeTab is the 0.

    Thanks
    Aurelio
  6. #6
    You can set up an Activate listener for the second tab to active the first tab.
  7. #7

Similar Threads

  1. Replies: 2
    Last Post: Jan 22, 2012, 2:00 PM
  2. Refresh page (tabpanel)
    By Kaido in forum 1.x Help
    Replies: 16
    Last Post: Oct 29, 2010, 1:02 PM
  3. Replies: 2
    Last Post: Jul 30, 2010, 12:37 AM
  4. Refresh combobox in iFrame from TabPanel
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Nov 15, 2009, 3:26 PM
  5. Replies: 3
    Last Post: Aug 21, 2009, 2:24 PM

Posting Permissions