[CLOSED] very strange null reference exception?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] very strange null reference exception?

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm8.aspx.cs" Inherits="TobrosCWT.pages.pingzheng.WebForm8" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
    </head>
    <script runat="server">
           
    
        public class Company
        {
            public int ID { get; set; }
            public string Name { get; set; }
        }
    
        public List<Company> GetData()
        {
            return new List<Company>
                    {
                        new Company{ID = 1,Name = "comp1"},
                        new Company{ID = 2,Name = "comp2"},
                    };
        }
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.BindData();
    
            }
        }
        private void BindData()
        {
            this.store1.DataSource = GetData();
            this.store1.DataBind();
        }
    
        protected void clickme(object sender, DirectEventArgs e)
        {
            this.cc_bz.Show();
        }
    
    </script>
    <body>
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server"></ext:ResourceManager>
            <ext:GridPanel runat="server" ID="gridpanel1" Height="100">
                <TopBar>
    
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button runat="server" Text="show the column">
                                <DirectEvents>
                                    <Click OnEvent="clickme"></Click>
                                </DirectEvents>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ext:Store>
                    <ext:Store runat="server" ID="store1">
                        <Model>
                            <ext:Model runat="server" IDProperty="ID">
                                <Fields>
                                    <ext:ModelField Name="ID" Type="Int" />
                                    <ext:ModelField Name="Name" />
    
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
    
                </ext:Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column runat="server" DataIndex="ID" Text="ID"></ext:Column>
                        <ext:Column ID="Column1" runat="server" DataIndex="Name" Text="NAME"></ext:Column>
    
                        <ext:ComponentColumn Hidden="true" ID="cc_bz" runat="server" Align="Right" Text="币别" DataIndex="bizhong" Editor="True" Width="230">
                            <Component>
                                <ext:Container ID="Container3" runat="server" Layout="HBoxLayout">
                                    <Items>
    
                                        <ext:ComboBox ID="ComboBox1" runat="server" ItemID="Currency" InputWidth="60">
                                            <Items>
                                                <ext:ListItem Text="USD" Value="1" Mode="Raw" />
                                                <ext:ListItem Text="EURO" Value="2" Mode="Raw" />
                                            </Items>
                                        </ext:ComboBox>
                                        <ext:TextField runat="server" InputWidth="60"></ext:TextField>
                                        <ext:TextField runat="server" FieldLabel="原币" LabelWidth="40" InputWidth="50"></ext:TextField>
                                    </Items>
                                </ext:Container>
                            </Component>
    
                        </ext:ComponentColumn>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
    this.store1 throws null reference exception, but I have defined the store1 in the gridpanel, why?
    Last edited by Daniil; Aug 06, 2013 at 9:28 AM. Reason: [CLOSED]

Similar Threads

  1. Null Reference Exception in MVC
    By geraldf in forum 2.x Help
    Replies: 1
    Last Post: Sep 07, 2012, 7:11 PM
  2. ComboBox SelectedItem gets null reference error
    By zfreeman in forum 2.x Help
    Replies: 1
    Last Post: Jul 31, 2012, 8:40 PM
  3. Combobox null value exception
    By softlabsgroup.support in forum 1.x Help
    Replies: 1
    Last Post: Jun 18, 2012, 11:21 PM
  4. [CLOSED] Null Reference Object Ajax
    By Oliver in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Jun 01, 2012, 2:18 PM
  5. Replies: 1
    Last Post: Jun 08, 2010, 12:38 PM

Posting Permissions