[CLOSED] DataView Template unable to read the store Record Field

  1. #1

    [CLOSED] DataView Template unable to read the store Record Field

    hi ,

    My environment:
    windows 7 64 bit.
    EXT.NET RC.
    Visual studio 2010.

    im try to show a window contained a dataview , the dataview gets its data from a store in the page, i face a set of problem:

    1. when i bind my store to a list<mydynamicobject> , the store is not filled and it is returned empty.
    2.when i bind my store to a list<object> it is working fine , but now i face problem where th store Record field are returned empty inside the template

    The code behind:s
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using SocialDealer.Data;
    using SocialNetworksUtility;
    using Ext.Net;
    using Ext.Net.Utilities;
    
    namespace DashboardTesting
    {
        public partial class DataViewwithwindow : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    List<object> results = new List<object>();
                    results.Add(new  { range = "5-9", rangevalue = "10" });
                    results.Add(new { range = "20-30", rangevalue = "20" });
                    // foreach (DataRow row in oset.Tables[0].Rows)
                    // {
                    //  results.Add(new FacebookRangeStatiscs() { range = row["range"].ToString(), value = row["value"].ToString() });
                    //}
    
                    //viewBy.DataSource = oset.Tables[0];
                    //viewBy.DataBind();
                    ByStore.DataSource = results;
                    ByStore.DataBind();
                    ByWindow.Show();
                }
            }
        }
    }
    and here is my aspx page HTML:

            <ext:ResourceManager ID="ResourceManager1" Theme="Gray" runat="server" DirectMethodNamespace="SocialDelear" />
      
      <ext:Store ID="ByStore" runat="server" AutoLoad="false" RemoteSort="false" ShowWarningOnFailure="true">
       <Reader>
         <ext:JsonReader>
                <Fields>
                       <ext:RecordField Name="range"/>
                       <ext:RecordField Name="rangevalue"/>
                 </Fields>
         </ext:JsonReader>
         </Reader> 
           
    </ext:Store>
       <ext:Window 
                ID="ByWindow" 
                runat="server" 
                Resizable="false"
                Height="200px"
                Hidden="true"
                Modal="true"
                Width="100" >
                <LoadMask ShowMask="true" />
               <Items>
               <ext:BorderLayout runat="server" ID="BorderLayout">
               <Center>
               <ext:Panel runat="server" AutoScroll="true">
               
               <Items>
                <ext:DataView ID="DataView3" runat="server" StoreID="ByStore" AutoHeight="true" MultiSelect="true"
                    OverClass="x-view-over" ItemSelector="div.thumb-wrap" EmptyText="No images to display">
                    <Template ID="Template5" runat="server">
                        <Html>
                        <tpl for=".">     
                        <table>
                        <tr>
                        <td>
                        muath bgool bas
                        </td>
                        <td>
                        {range}
                        </td>
                        </tr>
                        </table>     
                         </tpl>
                        <div class="x-clear"></div>
                        </Html>
                    </Template>
                    
                </ext:DataView>
               
                </Items>
                 </ext:Panel>
                </Center>
                </ext:BorderLayout>
            </Items>
            </ext:Window>
    
             <ext:Panel ID="Panel1" runat="server" Frame="true" Width="535" AutoHeight="true" Collapsible="true" title="the view">
               <Items>
                <ext:DataView ID="ImageView" runat="server" StoreID="ByStore" AutoHeight="true" 
                    OverClass="x-view-over" ItemSelector="div.thumb-wrap" EmptyText="No images to display">
                    <Template runat="server">
                        <Html>
                        <table>
                        <tpl for=".">  
                          <tr>
                          <td>
                            {range}
                           </td>
                           </tr>
                         </tpl>
                         </table>
                   
                        </Html>
                    </Template>
                    
                </ext:DataView>
               
                </Items>
    
                <Content>
                there is a content 
                </Content>
                 </ext:Panel>
    the imageview Dataview and DataView3 are not shown anything.

    i need really know two things:

    1. why when im using list of mycustomobject the store is empty and i wana tell that my mycustomobject is seiazable and have have empty constructor, and when im using list<object> the store have data.

    2.by now my store have data but my dataviews does not get these data (does not recognized my Store Record Fields).
    Last edited by Daniil; Dec 20, 2010 at 4:13 PM. Reason: [CLOSED]
  2. #2
    Hi,

    when i bind my store to a list<mydynamicobject> , the store is not filled and it is returned empty.
    Are range and value fields or properties in FacebookRangeStatiscs class? Serialization works with properties only

    when i bind my store to a list<object> it is working fine , but now i face problem where th store Record field are returned empty inside the template
    You have to define correct item selector (in your case ItemSelector points on unexisting components). Also, your store has AutoLoad="false", it means that data will not be loaded automatically, call load js method of the store or set true for that property

    itemSelector : String
    This is a required setting. A simple CSS selector (e.g. div.some-class or span:first-child) that will be used to determine what nodes this DataView will be working with.
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Register TagPrefix="uc10" TagName="Child" Src="Child.ascx" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                var results = new System.Collections.Generic.List<object>();
                results.Add(new { range = "5-9", rangevalue = "10" });
                results.Add(new { range = "20-30", rangevalue = "20" });
                // foreach (DataRow row in oset.Tables[0].Rows)
                // {
                //  results.Add(new FacebookRangeStatiscs() { range = row["range"].ToString(), value = row["value"].ToString() });
                //}
    
                //viewBy.DataSource = oset.Tables[0];
                //viewBy.DataBind();
                ByStore.DataSource = results;
                ByStore.DataBind();
                ByWindow.Show();
            }
        }
    </script>
    
    <!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 id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="DefaultForm" runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Store ID="ByStore" runat="server" AutoLoad="true" RemoteSort="false" ShowWarningOnFailure="true">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="range" />
                        <ext:RecordField Name="rangevalue" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:Window ID="ByWindow" runat="server" Resizable="false" Height="200px" Hidden="true"
            Modal="true" Width="100">
            <LoadMask ShowMask="true" />
            <Items>
                <ext:BorderLayout runat="server" ID="BorderLayout">
                    <Center>
                        <ext:Panel ID="Panel1" runat="server" AutoScroll="true">
                            <Items>
                                <ext:DataView ID="DataView3" runat="server" StoreID="ByStore" AutoHeight="true" MultiSelect="true"
                                    OverClass="x-view-over" ItemSelector="table" EmptyText="No images to display">
                                    <Template ID="Template5" runat="server">
                                        <Html>
                                        <tpl for=".">     
                                        <table>
                                        <tr>
                                        <td>
                                        muath bgool bas
                                        </td>
                                        <td>
                                        {range}
                                        </td>
                                        </tr>
                                        </table>     
                                         </tpl>
                                        <div class="x-clear"></div>
                                        </Html>
                                    </Template>
                                </ext:DataView>
                            </Items>
                        </ext:Panel>
                    </Center>
                </ext:BorderLayout>
            </Items>
        </ext:Window>
        <ext:Panel ID="Panel2" runat="server" Frame="true" Width="535" AutoHeight="true"
            Collapsible="true" Title="the view">
            <Items>
                <ext:DataView ID="ImageView" runat="server" StoreID="ByStore" AutoHeight="true" OverClass="x-view-over"
                    ItemSelector="tr" EmptyText="No images to display">
                    <Template runat="server">
                        <Html>
                        <table>
                        <tpl for=".">  
                          <tr>
                          <td>
                            {range}
                           </td>
                           </tr>
                         </tpl>
                         </table>
                        </Html>
                    </Template>
                </ext:DataView>
            </Items>
            <Content>
                there is a content
            </Content>
        </ext:Panel>
        </form>
    </body>
    </html>
  3. #3

    Thanks vladimer.

    Hi,

    thanks man , i follow your instructions and everything going perfectly, thanks alot :).

Similar Threads

  1. [CLOSED] Script into a DataView Template
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 10, 2012, 2:55 PM
  2. Replies: 1
    Last Post: Mar 29, 2012, 10:42 PM
  3. [CLOSED] Change value Store field within combobox and template
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 17, 2010, 2:18 PM
  4. [CLOSED] [1.0] DataView Template Question
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 08, 2010, 7:49 PM
  5. Replies: 0
    Last Post: Apr 23, 2009, 7:43 AM

Posting Permissions