PDA

View Full Version : [CLOSED] Get Current Page index in code behind



speedstepmem4
Oct 11, 2013, 6:12 AM
Hi,

Earlier version1.x we are used following source to get the page index,



int current_page = PagingToolBar1.PageIndex;


How to get current page index in code behind in v2.x?

Daniil
Oct 11, 2013, 9:04 AM
Hi @speedstepmem4,

Unfortunately, this functionality has gone. Please send it as an extra parameter.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store store = this.GridPanel1.GetStore();
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" }
};
}
}

protected void GetCurrentPage(object sender, DirectEventArgs e)
{
X.Msg.Alert("Current Page", e.ExtraParams["currentPage"]).Show();
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server" PageSize="3">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="test" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Test" DataIndex="test" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar runat="server" />
</BottomBar>
</ext:GridPanel>

<ext:Button runat="server" Text="Current page?">
<DirectEvents>
<Click OnEvent="GetCurrentPage">
<ExtraParams>
<ext:Parameter Name="currentPage" Value="App.GridPanel1.getStore().currentPage" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>

haytham
Feb 12, 2014, 11:25 AM
Hi,

Earlier version1.x we are used following source to get the page index,



int current_page = PagingToolBar1.PageIndex;


How to get current page index in code behind in v2.x?


Hi,
did you found a solution for your problem?

Daniil
Feb 12, 2014, 11:56 AM
Hi @haytham,

I believe the answer is in the post #2.

haytham
Feb 12, 2014, 7:52 PM
Hi @haytham,

I believe the answer is in the post #2.


Hi @Daniil ,
Thanks so much , It's working perfect !! :)