[CLOSED] Binding index to paging toolbar

  1. #1

    [CLOSED] Binding index to paging toolbar

    Hi,
    I am trying to give static page value in gridview. But paging tool bar ID didn't bind the value. For this, I implemented code as follows:

    (1) Taken pageIndex value in session variable
    
    In Page load i can perform this (Here PagingToolBar ID="pgtCombo")
    
    Session["pgIndex"]= pgtCombo.PageIndex;
    
    (2) Bind the data from database
    
    here i can get the Data Fron DataBase
    
    (3) Bind the pageIndex value to pagingToolbar(ID="pgtCombo")
        pgtCombo.PageIndex = (int)Session["pgIndex"];
    but i cant get the solution in page load i can give Session value as 2 but it will show first Page Only.

    What i want is if i give session value as 2 then the second page data should display.

    so plz solve My problem...

    Thanks In advance
    Last edited by Daniil; Nov 17, 2010 at 8:09 AM. Reason: [CLOSED]
  2. #2
    Hi,

    It should work. Please look at the following example.

    If the issue persist please provide us with a sample code how to reproduce the issue.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                Store store = this.Store1;
                store.DataSource = new object[] { 
                                             new object[] { "test1" },
                                             new object[] { "test2" },
                                             new object[] { "test3" },
                                             new object[] { "test4" },
                                             new object[] { "test5" },
                                             new object[] { "test6" },
                                             new object[] { "test7" },
                                             new object[] { "test8" },
                                             new object[] { "test9" }
                                    };
                store.DataBind();
                if (this.Session["PageIndex"] != null)
                {
                    this.PagingToolbar1.PageIndex = (int)this.Session["PageIndex"];
                }
            }
        }
    
        protected void SavePageIndex(object sender, AjaxEventArgs e)
        {
            this.Session["PageIndex"] = this.PagingToolbar1.PageIndex;    
        }
    
        protected void SetPageIndex(object sender, AjaxEventArgs e)
        {
            this.PagingToolbar1.PageIndex = 3;
        }
    </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 runat="server">
        <title>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            StoreID="Store1" 
            AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        <ext:Button runat="server" Text="Save PageIndex in Session">
            <AjaxEvents>
                <Click OnEvent="SavePageIndex" />
            </AjaxEvents>
        </ext:Button>
        <ext:Button runat="server" Text="Set PageIndex to 3">
            <AjaxEvents>
                <Click OnEvent="SetPageIndex" />
            </AjaxEvents>
        </ext:Button>
        </form>
    </body>
    </html>
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    It should work. Please look at the following example.

    If the issue persist please provide us with a sample code how to reproduce the issue.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                Store store = this.Store1;
                store.DataSource = new object[] { 
                                             new object[] { "test1" },
                                             new object[] { "test2" },
                                             new object[] { "test3" },
                                             new object[] { "test4" },
                                             new object[] { "test5" },
                                             new object[] { "test6" },
                                             new object[] { "test7" },
                                             new object[] { "test8" },
                                             new object[] { "test9" }
                                    };
                store.DataBind();
                if (this.Session["PageIndex"] != null)
                {
                    this.PagingToolbar1.PageIndex = (int)this.Session["PageIndex"];
                }
            }
        }
    
        protected void SavePageIndex(object sender, AjaxEventArgs e)
        {
            this.Session["PageIndex"] = this.PagingToolbar1.PageIndex;    
        }
    
        protected void SetPageIndex(object sender, AjaxEventArgs e)
        {
            this.PagingToolbar1.PageIndex = 3;
        }
    </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 runat="server">
        <title>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            StoreID="Store1" 
            AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        <ext:Button runat="server" Text="Save PageIndex in Session">
            <AjaxEvents>
                <Click OnEvent="SavePageIndex" />
            </AjaxEvents>
        </ext:Button>
        <ext:Button runat="server" Text="Set PageIndex to 3">
            <AjaxEvents>
                <Click OnEvent="SetPageIndex" />
            </AjaxEvents>
        </ext:Button>
        </form>
    </body>
    </html>
    now im in page3(in grid) when i click refresh button on paging tool bar it is redirecting to first page, i dont want like this, it should redirect to 3rd page(or current page)..
    
    protected void Page_Load(object sender, EventArgs e)
            {
                if (!Ext.IsAjaxRequest)
                {
                    Refresh();
                }
            }
    
    protected void Refresh_Click(object sender, StoreRefreshDataEventArgs e)
            {
                try
                {
                    Refresh();
                    int index = (int)Session["pgIndex"];
                    this.pgtCombo.PageIndex = index;
                    this.pgtCombo.PageSize = Convert.ToInt32(Session["pgSize"]);
                    Session["pgIndex"] = string.Empty;
                    Session["pgSize"] = string.Empty;
                }
                catch
                {
                    throw new Exception("Connection Error!");
                }
            }
    
    
    
    protected void Refresh()
            {
                try
                {
                    Session["pgIndex"] = this.pgtCombo.PageIndex;
                    Session["pgSize"] = Convert.ToInt32(pgtCombo.PageSize.ToString());               
                    string name = Convert.ToString(cmbSearch.SelectedItem.Value);
                    SqlConnection con = new SqlConnection(@"Integrated Security=SSPI;Initial Catalog=SUBBU; Data Source=vsspldev-09\SQLEXPRESS");
                    con.Open();
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandText = string.Format("SELECT * FROM EMPLOYEE");
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection = con;
                    cmd.ExecuteNonQuery();
                    DataSet ds = new DataSet();
                    SqlDataAdapter daa = new SqlDataAdapter(cmd);
                    daa.Fill(ds, "EMPLOYEE");
                    con.Close();
                    this.stoCombo.DataSource = ds;
                    this.stoCombo.DataBind();
                }
                catch
                {
                    throw new Exception("Connection Error!");
                }
            }
    
    
    Default.aspx
    -----------
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ComboSearch.Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!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> untitled</title>
    </head>
    <body >
        <form id="form1" runat="server">    
          <ext:ScriptManager ID="ScriptManager1" runat="server" >
    </ext:ScriptManager>
    <ext:Store ID="stoCombo" runat="server" OnRefreshData = "Refresh_Click" >
    <Reader>
     <ext:JsonReader>
      <Fields>
       <ext:RecordField Name="EMPLOYEEID" />
       <ext:RecordField Name="EMPLOYEENAME" />
      </Fields>
     </ext:JsonReader>
    </Reader>
    </ext:Store>
    <ext:Button ID="btnCombo" runat="server" Text="click">
     <AjaxEvents>
      <Click OnEvent="btnClick" />
     </AjaxEvents>
    </ext:Button>
    <ext:GridPanel ID="grdCombo" runat="server" Height="250" StoreID="stoCombo" ViewStateMode="Enabled" >
     <ColumnModel>
      <Columns>
       <ext:Column DataIndex="EMPLOYEEID" Header="Id" />
       <ext:Column DataIndex="EMPLOYEENAME" Header="Name" />
      </Columns>
     </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar ID="pgtCombo" runat="server" PageSize="3" StoreID="stoCombo" 
                     DisplayInfo="true" DisplayMsg="Displaying Invoice Details {0} - {1} of {2}" EmptyMsg="No Invoice Details To Display"  >
                    </ext:PagingToolbar>
                </BottomBar>
    </ext:GridPanel>
        </form>
    </body>
    </html>
  4. #4
    Hi,

    Unfortunately the code you posted is not compilable. Could you prepare a compilable sample code to reproduce?

    Did you investigate Paging examples in Coolite's source?
  5. #5
    Quote Originally Posted by Daniil View Post
    Hi,

    Unfortunately the code you posted is not compilable. Could you prepare a compilable sample code to reproduce?

    Did you investigate Paging examples in Coolite's source?

    
    Default.aspx.cs
    ------------------
    using System;
    using System.Data;
    using System.Linq;
    using System.Data.SqlClient;
    using Coolite.Ext.Web;
    using System.Collections.Generic;
    using System.Web.UI.WebControls;
    
    namespace ComboSearch
    {
        public partial class Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Ext.IsAjaxRequest)
                {
                    Refresh();
                }
            } 
    
            protected void Refresh_Click(object sender, StoreRefreshDataEventArgs e)
            {
                try
                {
                    Refresh();
                    int index = (int)Session["pgIndex"];
                    this.pgtCombo.PageIndex = 3;
                    this.pgtCombo.PageSize = Convert.ToInt32(Session["pgSize"]);
                    Session["pgIndex"] = string.Empty;
                    Session["pgSize"] = string.Empty;
                }
                catch
                {
                    throw new Exception("Connection Error!");
                }
            }
    
            protected void Refresh()
            {
                try
                {
                    Session["pgIndex"] = this.pgtCombo.PageIndex;
                    Session["pgSize"] = Convert.ToInt32(pgtCombo.PageSize.ToString());               
                    string name = Convert.ToString(cmbSearch.SelectedItem.Value);
                    SqlConnection con = new SqlConnection(@"Integrated Security=SSPI;Initial Catalog=SUBBU; Data Source=vsspldev-09\SQLEXPRESS");
                    con.Open();
                    SqlCommand cmd = new SqlCommand();
                    cmd.CommandText = string.Format("SELECT * FROM EMPLOYEE");
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection = con;
                    cmd.ExecuteNonQuery();
                    DataSet ds = new DataSet();
                    SqlDataAdapter daa = new SqlDataAdapter(cmd);
                    daa.Fill(ds, "EMPLOYEE");
                    con.Close();             
                    this.stoCombo.DataSource = ds;
                    this.stoCombo.DataBind();
                }
                catch
                {
                    throw new Exception("Connection Error!");
                }
            }        
            protected void SetPageIndex(object sender, AjaxEventArgs e)
            {
                this.pgtCombo.PageIndex = 3;
            }
        }
    }
    
    
    
    Default.aspx
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ComboSearch.Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!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> Search Element</title>
    </head>
    <body >
        <form id="form1" runat="server">
        
          <ext:ScriptManager ID="ScriptManager1" runat="server" >
    </ext:ScriptManager>
    <ext:Store ID="stoCombo" runat="server" OnRefreshData = "Refresh_Click"  >
    <Reader>
     <ext:JsonReader >
      <Fields >
       <ext:RecordField Name="EMPLOYEEID" />
       <ext:RecordField Name="EMPLOYEENAME" />
      </Fields>
     </ext:JsonReader>
    </Reader>
    </ext:Store>
    
    <ext:ComboBox ID="cmbSearch" runat="server" MinChars="1" LoadingText="Searching..." StoreID="stoCombo" DisplayField ="EMPLOYEENAME" TypeAhead="true"
                    ValueField="EMPLOYEENAME">
    <Template ID="Template1" runat="server">
                       <tpl for=".">
                          <div class="search-item">
                             <h1>{EMPLOYEENAME}</h1>                       
                          </div>
                       </tpl>
                    </Template>
    </ext:ComboBox>
    <ext:Button ID="btnCombo" runat="server" Text="click">
     <AjaxEvents>
      <Click OnEvent="btnClick" />
     </AjaxEvents>
    </ext:Button>
    <ext:GridPanel ID="grdCombo" runat="server" Height="250" StoreID="stoCombo" ViewStateMode="Enabled" >
     <ColumnModel>
      <Columns>
       <ext:Column DataIndex="EMPLOYEEID" Header="Id" />
       <ext:Column DataIndex="EMPLOYEENAME" Header="Name" />
      </Columns>
     </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar ID="pgtCombo" runat="server" PageSize="3" StoreID="stoCombo" 
                     DisplayInfo="true" DisplayMsg="Displaying Invoice Details {0} - {1} of {2}" EmptyMsg="No Invoice Details To Display"  >                       
                </ext:PagingToolbar>
                </BottomBar>
    </ext:GridPanel>
        </form>
    </body>
    </html>
  6. #6
    Hi,

    I'm still unable to run your code because it's depend on database. But I understood where the problem is.

    Please use the following workaround (see //Workaround comment in code behind)

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server">
        public List<object> MyData = new List<object>
        { 
            new {test = "test1"},
            new {test = "test2"},
            new {test = "test3"},
            new {test = "test4"},
            new {test = "test5"},
            new {test = "test6"},
            new {test = "test7"},
            new {test = "test8"},
            new {test = "test9"}
        };
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = MyData;
                this.Store1.DataBind();
            }
        }
    
        protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            this.Store1.DataSource = MyData;
            this.Store1.DataBind();
            PagingToolbar1.SetPageIndex(PagingToolbar1.PageIndex);  //Workaround
        }
    </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 runat="server">
        <title>Coolite 0.8.x Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="3" Mode="Raw" />
            </BaseParams>
        </ext:Store>
        <ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Nov 13, 2010 at 7:11 AM.
  7. #7
    Quote Originally Posted by Daniil View Post
    Hi,

    I'm still unable to run your code because it's depend on database. But I understood where the problem is.

    Please use the following workaround (see //Workaround comment in code behind)

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server">
        public List<object> MyData = new List<object>
        { 
            new {test = "test1"},
            new {test = "test2"},
            new {test = "test3"},
            new {test = "test4"},
            new {test = "test5"},
            new {test = "test6"},
            new {test = "test7"},
            new {test = "test8"},
            new {test = "test9"}
        };
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = MyData;
                this.Store1.DataBind();
            }
        }
    
        protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            this.Store1.DataSource = MyData;
            this.Store1.DataBind();
            PagingToolbar1.SetPageIndex(PagingToolbar1.PageIndex);  //Workaround
        }
    </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 runat="server">
        <title>Coolite 0.8.x Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="3" Mode="Raw" />
            </BaseParams>
            <WriteBaseParams>
                <ext:Parameter Name="test" Value="Hello!" Mode="Value" />
            </WriteBaseParams>
        </ext:Store>
        <ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        </form>
    </body>
    </html>

    Hi,
    I created a grid view in Coolite.Ext. It consists PagingToolBAr. It displays 3 records in each page
    in grid view. Let us consider, we are seeing second page data. Now, we press refresh button in PagingToolbar then
    automatically, it displys first page data. If we viewing , 20 th page in project, then it redirect to first page means
    it is a big problem to user. But in Ext.Net version 1.0 it is working properly, we are using Coolite 0.8, so solve as early as possible.

    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Employe.aspx.cs" Inherits="ComboSearch.Employe" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <script runat="server">
       public List<object> MyData = new List<object>
       {
           new {test = "test1"},
           new {test = "test2"},
           new {test = "test3"},
           new {test = "test4"},
           new {test = "test5"},
           new {test = "test6"},
           new {test = "test7"},
           new {test = "test8"},
           new {test = "test9"}
       };
    
    
       protected void Page_Load(object sender, EventArgs e)
       {
           if (!Ext.IsAjaxRequest)
           {
               this.Store1.DataSource = MyData;
               this.Store1.DataBind();
           }
       }
    
       protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
       {
           this.Store1.DataSource = MyData;
           this.Store1.DataBind();
           PagingToolbar1.SetPageIndex(PagingToolbar1.PageIndex);  //Workaround
    
       }
    </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 runat="server">
        <title></title>
    </head>
    <body>
        <form id="Form1" runat="server">
       <ext:ScriptManager ID="ScriptManager1" runat="server" />
       <ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
           <Reader>
               <ext:JsonReader>
    
                   <Fields>
                       <ext:RecordField Name="test" />
                   </Fields>
               </ext:JsonReader>
           </Reader>
           <BaseParams>
               <ext:Parameter Name="start" Value="0" Mode="Raw" />
               <ext:Parameter Name="limit" Value="3" Mode="Raw" />
           </BaseParams>
           <WriteBaseParams>
               <ext:Parameter Name="test" Value="Hello!" Mode="Value" />
           </WriteBaseParams>
       </ext:Store>
       <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" AutoHeight="true">
           <ColumnModel ID="ColumnModel1" runat="server">
               <Columns>
                   <ext:Column Header="Test" DataIndex="test" />
               </Columns>
           </ColumnModel>
           <BottomBar>
               <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
           </BottomBar>
       </ext:GridPanel>
       </form>
    </body>
    </html>
  8. #8
    Please clarify have you tested the example that I posted? The Refresh button works there as you need.

    What exactly toolkit's version do you use?
  9. #9
    Quote Originally Posted by Daniil View Post
    Please clarify have you tested the example that I posted? The Refresh button works there as you need.

    What exactly toolkit's version do you use?
    coolite: 0.8.1.987
    Visual Studio: 2010 (framework 4.0)
  10. #10
    Hi,

    I see you use different toolkit's version. In the future please clarify the version in the initial post. It can really save our and your time.

    The following code works as you need in 0.8.1. Please look at this.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
     
    <script runat="server">
        public List<object> MyData = new List<object>
        {
            new {test = "test1"},
            new {test = "test2"},
            new {test = "test3"},
            new {test = "test4"},
            new {test = "test5"},
            new {test = "test6"},
            new {test = "test7"},
            new {test = "test8"},
            new {test = "test9"}
        };
     
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = MyData;
                this.Store1.DataBind();
            }
        }
     
        protected void Store_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            this.Store1.DataSource = MyData;
            this.Store1.DataBind();
            
            //workaround
            var i = PagingToolbar1.PageIndex.ToString();
            PagingToolbar1.AddScript("PagingToolbar1.changePage.defer(1, PagingToolbar1, [" + i + "]);");
            //end of workaround
        }
    </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 runat="server">
        <title>Coolite 0.8.x Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="3" Mode="Raw" />
            </BaseParams>
        </ext:Store>
        <ext:GridPanel runat="server" StoreID="Store1" AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Nov 15, 2010 at 10:12 AM.

Similar Threads

  1. [CLOSED] paging toolbar events
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 05, 2013, 4:52 AM
  2. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  3. Paging ToolBar Problem
    By kiran malgi in forum 1.x Help
    Replies: 2
    Last Post: Mar 29, 2010, 8:25 AM
  4. [CLOSED] Paging Toolbar with Grid
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 23, 2009, 3:08 AM
  5. paging toolbar on extjs
    By [WP]joju in forum 1.x Help
    Replies: 4
    Last Post: Oct 22, 2009, 8:21 AM

Posting Permissions