PDA

View Full Version : [CLOSED] Adding FormPanel Items from Codebehind



debarry
Jun 25, 2014, 7:39 PM
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!

Daniil
Jun 25, 2014, 8:24 PM
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.

debarry
Jun 25, 2014, 8:57 PM
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.

Daniil
Jun 26, 2014, 4:54 AM
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

debarry
Jun 26, 2014, 2:33 PM
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.

Daniil
Jun 26, 2014, 5:58 PM
Unfortunately, the Ext.NET documentation is still a problem for us. Please read this post:
http://forums.ext.net/showthread.php?17864&p=77122&viewfull=1#post77122

debarry
Jun 26, 2014, 6:07 PM
Unfortunately, the Ext.NET documentation is still a problem for us. Please read this post:
http://forums.ext.net/showthread.php?17864&p=77122&viewfull=1#post77122

I see... lets use community then! :D

Hope documentation comes out soon.

Thank you.