[CLOSED] Fieldset don't show added items with autopostback - aspx view

  1. #1

    [CLOSED] Fieldset don't show added items with autopostback - aspx view

    Hello,

    if i select an item with the combobox, i would like to add items in Fieldset with CodeBehind.

    .cs
     foreach (var r_catering in l_catering)
                    {
                        var cb = new Ext.Net.Checkbox() { BoxLabel = r_catering.Cate_Name, Tag = r_catering.Cate_ID, HideLabel = true, Checked = false };
                        this.fs_catering.Items.Add(cb);
                    }
    .aspx
       <ext:FieldSet runat="server" Title="Catering" ID="fs_catering" Layout="VBoxLayout" Disabled="true">
                                                <LayoutConfig>
                                                    <ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
                                                </LayoutConfig>
                                                <Items>
    </ext:FieldSet>


    Why are not displayed this items in FieldSet ?? when I change the title, it appears!

    Thanks.
    Last edited by Daniil; Sep 10, 2013 at 9:38 AM. Reason: [CLOSED]
  2. #2
    Hi @ontiv,

    I cannot reproduce with this test case. Please provide your one.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                var cb = new Ext.Net.Checkbox() { BoxLabel = "Checkbox" };
                this.FieldSet1.Items.Add(cb);
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox ID="ComboBox1" runat="server" AutoPostBack="true">
                <Items>
                    <ext:ListItem Text="Item 1" Value="1" />
                </Items>
            </ext:ComboBox>
    
            <ext:FieldSet ID="FieldSet1" runat="server" />
        </form>
    </body>
    </html>
  3. #3
    Hi Daniil,

    I've tried your example but this work not for me. Now I have solved the problem with Ext.JS.

    You can close this thread.

    Thanks for help.
  4. #4
    OK.

    By the way, sharing a solution can help others in the future.
  5. #5
    Yes, this is right!

    Here my solution. I've use now a store and js-script function for loading my items in fieldset.

    .js
    var BuildItems = function () {
                
                var st_items = Ext.getCmp('gp_items').getStore();
                var fs_items = Ext.getCmp('fs_items');
    
                fs_items.removeAll();
    
                st_items.each(function (record) {
                   
                    var cb_cate = new Ext.form.field.Checkbox({
                        boxLabel: record.get('name'),
                        hideLabel: true,
                        fieldLabel: new String(record.get('cateID'))
                    });
    
                    fs_items.add(cb_cate);
    
                }, this);
            }
    .aspx
    <ext:GridPanel runat="server" ID="gp_items" Hidden="true">
                <Store>
                    <ext:Store ID="st_items" runat="server"
                        RemoteSort="False">
                        <Model>
                            <ext:Model ID="m_items" runat="server" IDProperty="cateID">
                                <Fields>
                                    <ext:ModelField Name="cateID" />
                                    <ext:ModelField Name="name" />
                                </Fields>
                            </ext:Model>
                        </Model>
                        <Listeners>
                            <DataChanged Handler="BuildItems();"></DataChanged>
                        </Listeners>
                    </ext:Store>
                </Store>
            </ext:GridPanel>
    
     <ext:FieldSet runat="server" Title="Items" ID="fs_items" Layout="VBoxLayout" >
                                                <LayoutConfig>
                                                   <ext:VBoxLayoutConfig Align="Stretch"></ext:VBoxLayoutConfig>
                                                </LayoutConfig>
    </ext:FieldSet>
    .cs
    
    //.....
    //List with my Items
    
       st_items.DataSource = l_catering_items;
       st_items.DataBind();
  6. #6
    Thank you for sharing!

Similar Threads

  1. [CLOSED] MVC Examples -- Items -- ASPX Engine example problem
    By ontiv in forum 2.x Legacy Premium Help
    Replies: 19
    Last Post: Dec 20, 2012, 6:21 AM
  2. FormPanel with strongly-typed aspx view
    By fosteliss in forum 2.x Help
    Replies: 8
    Last Post: Aug 17, 2012, 9:10 PM
  3. [CLOSED] dynamically added custom controls not rendered in fieldset
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 25
    Last Post: Feb 24, 2012, 2:58 PM
  4. Replies: 2
    Last Post: Feb 01, 2012, 8:53 PM
  5. [CLOSED] Dynamically Added Tab not rendering partial view
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Apr 26, 2011, 9:10 PM

Posting Permissions