[CLOSED] DataView Bind Issue

  1. #1

    [CLOSED] DataView Bind Issue

    Hi,

    Please run below code. If I DataBind first times, it's working. But if I fire second times, it's error.

    Please Advise.

    <%@ Page Language="C#" AutoEventWireup="true" %>
    
    
    <!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>
        <script runat="server">
    
    
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    stMaintenanceCategory.DataSource = new object[]
                    {
                        new {Text = "1", Value = "1"},
                        new {Text = "2", Value = "2"},
                        new {Text = "3", Value = "3"},
                        new {Text = "4", Value = "4"},
                        new {Text = "5", Value = "5"},
                        new {Text = "6", Value = "6"}
                    };
                    stMaintenanceCategory.DataBind();
                }
            }
    
    
            protected void BindDataView(object sender, DirectEventArgs e)
            {
                stMaintenanceDetails.DataSource = new object[]
                {
                    new {Value = "1"},
                    new {Value = "2"},
                    new {Value = "3"},
                    new {Value = "4"},
                    new {Value = "5"},
                    new {Value = "6"}
                };
                stMaintenanceDetails.DataBind();
            }
    
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager runat="server">
        </ext:ResourceManager>
        <ext:Button runat="server" Text="Bind Data View" OnDirectClick="BindDataView"></ext:Button>
        <ext:Store runat="server" ID="stMaintenanceCategory">
            <Model>
                <ext:Model ID="Model11" runat="server">
                    <Fields>
                        <ext:ModelField Name="Text">
                        </ext:ModelField>
                        <ext:ModelField Name="Value">
                        </ext:ModelField>
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
        <ext:DataView ID="DataView1" runat="server" DisableSelection="true">
            <Store>
                <ext:Store ID="stMaintenanceDetails" runat="server">
                    <Model>
                        <ext:Model ID="Model8" runat="server" Name="MaintenanceDetail">
                            <Fields>
                                <ext:ModelField Name="Value" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ItemTpl ID="ItemTpl1" runat="server">
                <Html>
                    <tpl>
                        <div style="margin: 10px;">{Value}</div>
                                    </tpl>
                </Html>
            </ItemTpl>
            <Plugins>
                <ext:ComponentView ID="ComponentView1" runat="server">
                    <Items>
                        <ext:ViewItem Value="Value" BoundField="Value">
                            <Component>
                                <ext:ComboBox ID="ComboBox1" runat="server" Width="230" DisplayField="Text" StoreID="stMaintenanceCategory"
                                    ValueField="Value">
                                </ext:ComboBox>
                            </Component>
                        </ext:ViewItem>
                    </Items>
                </ext:ComponentView>
            </Plugins>
        </ext:DataView>
        </form>
    </body>
    </html>
    Last edited by Daniil; Jul 08, 2014 at 7:47 AM. Reason: [CLOSED]
  2. #2
    Hi @Webezi,

    It appears to be working for me.
    But if I fire second times, it's error.
    Please always provide more information about errors.
  3. #3
    Hi Daniil,

    Please see below picture, when I click the button second time, it shows the JS error

    Attached Thumbnails Click image for larger version. 

Name:	4444444444444.png 
Views:	216 
Size:	32.2 KB 
ID:	13341  
  4. #4
    Please specify the versions of IE and Ext.NET that you are using.
  5. #5
    I used IE11 and Ext.Net 2.5.1.24957
  6. #6
    Please try to set AutoDestroy="false" for the stMaintenanceCategory Store.
  7. #7
    It's working now. Thanks very much.

Similar Threads

  1. Replies: 2
    Last Post: Feb 24, 2014, 4:03 AM
  2. [CLOSED] Dataview Collapse Issue
    By hidaextnet in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 12, 2013, 2:59 PM
  3. DataView with ComponentView - Form bind
    By infotex in forum 2.x Help
    Replies: 3
    Last Post: Apr 29, 2013, 6:33 AM
  4. [CLOSED] DataView to DataView Drag and Drop
    By paulc in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 10, 2012, 8:19 PM
  5. Bind objects from LINQ to DataView
    By Skorfulose in forum 1.x Help
    Replies: 0
    Last Post: Dec 18, 2009, 5:03 AM

Posting Permissions