gridPanel (in updatePanel) disappears after partial postback

  1. #1

    gridPanel (in updatePanel) disappears after partial postback

    Hi,

    I have a problem with partial postback when there is ext.net gridpanel inside updatePanel -
    I have a button in updatePanel, and when clicking on it - it calls a gridPanel (which is also in UpdatePanel). But - the gridPanel actually appears only after first page-loaded, and by clicking the button - not.

    Here is my code:


    <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="uPnlBtn" runat="server">
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Partial Postback" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        <asp:UpdatePanel ID="uPnlGrid" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <ext:GridPanel ID="GridPanel1" runat="server" StripeRows="true" AutoHeight="true">
                    <Store>
                        <ext:Store ID="Store1" runat="server">
                            <Reader>
                                <ext:JsonReader>
                                    <Fields>
                                        <ext:RecordField Name="a1" />
                                        <ext:RecordField Name="a2" />
                                        <ext:RecordField Name="a3" />
                                        <ext:RecordField Name="a4" />
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>
                            <ext:Column Header="a11" DataIndex="a1">
                            </ext:Column>
                            <ext:Column Header="a21" DataIndex="a2">
                            </ext:Column>
                            <ext:Column Header="a31" DataIndex="a3">
                            </ext:Column>
                            <ext:Column Header="a41" DataIndex="a4">
                            </ext:Column>
                        </Columns>
                    </ColumnModel>
                </ext:GridPanel>
            </ContentTemplate>
        </asp:UpdatePanel>
    
     public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {      
                    LoadGrid();
            }
    
            protected void Button1_Click(object sender, EventArgs e)
            {
             
                    LoadGrid();
                    uPnlGrid.Update();
            }
    
            private void LoadGrid()
            {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("a1");
                    dt.Columns.Add("a2");
                    dt.Columns.Add("a3");
                    dt.Columns.Add("a4");
    
                    for (int i = 0; i < 10; i++)
                    {
                        DataRow dr = dt.NewRow();
    
                        dr["a1"] = "aaa";
                        dr["a2"] = "bbb";
                        dr["a3"] = "ccc";
                        dr["a4"] = "ddd";
    
                        dt.Rows.Add(dr);
                    }
    
                    this.Store1.DataSource = dt;
                    Store1.DataBind();
            }
        }
    Thanks!
    Last edited by rach; Mar 22, 2012 at 11:38 AM.

Similar Threads

  1. Replies: 0
    Last Post: Apr 18, 2012, 9:40 AM
  2. Replies: 2
    Last Post: Mar 28, 2012, 10:13 AM
  3. Partial postback
    By hardik in forum 1.x Help
    Replies: 0
    Last Post: Apr 12, 2011, 2:53 PM
  4. [CLOSED] [1.0] Formpanel with partial postback
    By betamax in forum 1.x Premium Help
    Replies: 2
    Last Post: May 29, 2010, 2:54 PM
  5. DateField disapears after UP partial postback
    By ljcorreia in forum 1.x Premium Help
    Replies: 4
    Last Post: Aug 06, 2009, 8:07 AM

Posting Permissions