[CLOSED] Adding FormPanel Items from Codebehind

  1. #1

    [CLOSED] Adding FormPanel Items from Codebehind

    I need to programatically add items to a FormPanel from code behind, in a DirectEvent.
    I have this so far:

    <ext:FormPanel ID="FormPanelIndex" runat="server" ButtonAlign="Right" Title="Classifica??o de Documentos">
        <Items>
            <ext:FieldSet ID="FieldSetIndex" runat="server" ColumnWidth="0.4" Title="Classifica??o" MarginSpec="10" ButtonAlign="Right">
                <Defaults>
                    <ext:Parameter Name="Width" Value="240" />
                    <ext:Parameter Name="LabelWidth" Value="80" />
                </Defaults>
                <Items>
                    <ext:SelectBox ID="DDIdClass" runat="server" DisplayField="ClassTitulo" ValueField="IdClass" FieldLabel="Classifica??o" ondirectselect="DDIdClass_DirectSelect" >
                        <Store>
                            <ext:Store ID="Store3" runat="server" DataSourceID="SqlDataSourceClassList">
                                <Model>
                                    <ext:Model ID="ModelClass" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="IdClass" />
                                            <ext:ModelField Name="ClassTitulo" />
                                        </Fields>
                                    </ext:Model>
                                </Model>            
                            </ext:Store>    
                        </Store>
                    </ext:SelectBox>
                    <ext:TextField ID="TbIdDoc" Name="IdVersao" runat="server" FieldLabel="#Doc" ReadOnly="True" />
                    <ext:TextField ID="TbDocTitulo" Name="DocTitulo" runat="server" FieldLabel="Titulo" />
                </Items>                    
            </ext:FieldSet>
        </Items>
        <Buttons>
            <ext:Button ID="BtSave" runat="server" Icon="Disk" Text="Salvar" OnDirectClick="BtSave_OnDirectClick" />
        </Buttons>
    </ext:FormPanel>
    AND

    <ext:GridPanel ID="GridPanel1" runat="server" ColumnWidth="0.6" MultiSelect="True">
        <Store>
            <ext:Store ID="Store1" runat="server" PageSize="25" DataSourceID="SqlDataSourceDocumentoList">
                <Model>
                    <ext:Model ID="Model2" runat="server" IDProperty="IdVersao">
                        <Fields>
                            <ext:ModelField Name="IdVersao"/>
                            <ext:ModelField Name="DocTitulo" />
                            <ext:ModelField Name="VerNomeArquivo" />
                            <ext:ModelField Name="VerTamanho"/>
                            <ext:ModelField Name="VerDataCriacao" />
                            <ext:ModelField Name="VerNumeroVersao" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>            
        </Store>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ID="Column1" runat="server" Text="#" Width="50" Sortable="true" DataIndex="IdVersao"/>
                <ext:Column ID="Column2" runat="server" Text="Titulo" Width="300" Sortable="true" DataIndex="DocTitulo"/>
                <ext:Column ID="Column3" runat="server" Text="Nome Arquivo" Width="300" Sortable="true" DataIndex="VerNomeArquivo"/>
                <ext:Column ID="Column4" runat="server" Text="Tamanho" Width="100" Sortable="true" DataIndex="VerTamanho">
                    <Renderer Format="FileSize" />
                </ext:Column>
                <ext:DateColumn ID="Column5" runat="server" Text="Data Cria??o" Width="80" Sortable="true" DataIndex="VerDataCriacao" Format="dd/MM/Y" />
                <ext:Column ID="Column6" runat="server" Text="Vers?o" Width="80" Sortable="true" DataIndex="VerNumeroVersao"/>
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" DisplayInfo="false">
            </ext:PagingToolbar>
        </BottomBar>
        <Listeners>
            <SelectionChange Handler="if (selected[0]) { #{FormPanelIndex}.getForm().loadRecord(selected[0]); } App.direct.DE.CarregaDocumento();" />
        </Listeners>
    
    </ext:GridPanel>
    AND finally:

    [DirectMethod]
    public void CarregaDocumento()
    {
        //CODE
    }
    I can manipulate the database from CarregaDocumento() section, but things like SqlDataSource.Databind() doesnt work...
    What am I missing?

    Thanks in advance!
    Last edited by Daniil; Jun 27, 2014 at 10:37 AM. Reason: [CLOSED]
  2. #2
    Hi @debarry,

    Is the GridPanel inside a user control which you load on the fly?

    Well, if you need to get
    SqlDataSource.Databind()
    you'll probably need to recreate the user control on each request it is usually done in ASP.NET.

    Though I am not 100% sure how everything is configured on your side. If you can provide a full test case to reproduce the problem, we could tell more.
  3. #3
    I'll create another topic about this issue later on.
    Now I need to programatically add items to a FormPanel from code behind, in a DirectEvent.

    Thanks.
    Last edited by geoffrey.mcgill; Jun 25, 2014 at 9:20 PM.
  4. #4
    Quote Originally Posted by debarry View Post
    Now I need to programatically add items to a FormPanel from code behind, in a DirectEvent.
    Please investigate there examples:
    http://examples2.ext.net/#/search/xrender
  5. #5
    Quote Originally Posted by Daniil View Post
    Please investigate there examples:
    http://examples2.ext.net/#/search/xrender
    THank you.

    Is there anywhere I can look for information about the controls and their properties and methods?
    I feel like I dont much places to look for when I need....

    Thanks again.
  6. #6
    Unfortunately, the Ext.NET documentation is still a problem for us. Please read this post:
    http://forums.ext.net/showthread.php...ll=1#post77122
  7. #7
    Quote Originally Posted by Daniil View Post
    Unfortunately, the Ext.NET documentation is still a problem for us. Please read this post:
    http://forums.ext.net/showthread.php...ll=1#post77122
    I see... lets use community then! :D

    Hope documentation comes out soon.

    Thank you.

Similar Threads

  1. adding FieldSet from codebehind
    By bekengelistir in forum 2.x Help
    Replies: 2
    Last Post: Nov 03, 2013, 7:43 PM
  2. [CLOSED] Adding listerner to imagecommandcolumn from codebehind
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 04, 2012, 1:04 PM
  3. Adding Tab using codebehind
    By gevik in forum 1.x Help
    Replies: 9
    Last Post: Oct 02, 2011, 7:43 PM
  4. FormPanel CodeBehind item adding BUG
    By davutengin in forum 1.x Help
    Replies: 3
    Last Post: Jun 18, 2009, 1:26 PM
  5. FormPanel CodeBehind item adding
    By davutengin in forum 1.x Help
    Replies: 0
    Last Post: Jun 15, 2009, 5:53 AM

Posting Permissions