﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Custom Paging from Code Behind only (no ISDataSource being set in aspx file)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Custom-Paging-from-Code-Behind-only-no-ISDataSource-being-set-in-aspx-file/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Custom Paging from Code Behind only (no ISDataSource being set in aspx file)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Custom-Paging-from-Code-Behind-only-no-ISDataSource-being-set-in-aspx-file/</link><pubDate>Thu, 21 Jul 2011 04:02:51 GMT</pubDate><dc:creator>handy@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello Pendry,&lt;/p&gt;&lt;p&gt;You can see those files in our WebGrid sample&amp;gt;&amp;gt;App_Code&amp;gt;&amp;gt;dsNorthwind_extended.cs.&lt;br /&gt;The sample that used that method is ClassicPagingUsingCustomDataRetrieval.aspx.&lt;/p&gt;
&lt;p&gt;Let's me explain the behaviour and logic in this code snippet.&lt;/p&gt;
&lt;p&gt;1. Here is the first load.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.intersoftpt.com/tdn/downloads/query1.png" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /&gt; &lt;/p&gt;
&lt;p&gt;At first, startRowIndex would start from 0 and maximumRows would start from 25.&lt;br /&gt;In this case, startRowIndex and maximumRows are handled automatically by WebGrid.&lt;br /&gt;In this sample, the paging size is left as default, which is 25. That's why maximumRows is 25.&lt;br /&gt;startRowIndex starts from 0, means that WebGrid is still in page 1.&lt;br /&gt;You can see the query details in the image.&lt;/p&gt;
&lt;p&gt;2. Here is what hapenned if we navigate into the second page.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.intersoftpt.com/tdn/downloads/query2.png" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " /&gt; &lt;/p&gt;
&lt;p&gt;When you navigate into the second page (or maybe others page), startRowIndex would start from 25.&lt;br /&gt;As I said before, WebGrid handled this automatically. The number page increased into 2 which would show the next startRowIndex based on your paging size.&lt;/p&gt;
&lt;p&gt;3. If you do sorting during this scenario, you can also see that it will load based on your sortExpression which is also handled by WebGrid automatically.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.intersoftpt.com/tdn/downloads/query3.png" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; " alt="" /&gt; &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;For your information, all those paging are using ISDataSource.&lt;br /&gt;If you don't want to use ISDataSource at all, you can your own query at InitializeDataSource event.&lt;br /&gt;E.g in our WebGrid Tutorial&amp;gt;&amp;gt;V 3.5&amp;gt;&amp;gt;CustomVirtualLoad.aspx.&lt;br /&gt;It is using VirtualLoad as its paging mode.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Handy&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Custom Paging from Code Behind only (no ISDataSource being set in aspx file)</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Custom-Paging-from-Code-Behind-only-no-ISDataSource-being-set-in-aspx-file/</link><pubDate>Wed, 20 Jul 2011 10:39:33 GMT</pubDate><dc:creator>davidpendry</dc:creator><description>)
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a webgrid which is bound from a cutom object. The Grid is bound to a single object of type&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;public class BindMyData : CollectionBase, IHierarchicalList&lt;/p&gt;
&lt;p&gt;{...}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;All works fine on paging if the PagingMode="ClassicPaging" is implemented &amp; load on demand i NOT set.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The problem aries is when the attribute PagingLoadMode="Custom" is set. (I need to set this flag due to the very slow load time on initial requests to get ALL the object collection, therebye allowing the collection to be loaded by page each time)&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Can you please provide a complete code behind solution for this ?&lt;/p&gt;
&lt;p&gt;From the documentation it look as if&lt;br /&gt;the WebGrid framework expects a ISDataSource to implement a SelectCountMethod="GetCount"&lt;br /&gt; and SelectMethod="GetData" in which the following is required.&lt;/p&gt;
&lt;p&gt;-&amp;gt; public DataTable GetData(int startRowIndex, int maximumRows, string sortExpression)&lt;/p&gt;
&lt;p&gt;How do i get paging forward and backward to initiate a postback so i can handle the event myself ?&lt;br /&gt;How do i get the targetted page number ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Pendry&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>