<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: On-Demand Paging using ExtJS Grid with Client-Centric ASP.NET AJAX (WebMethods)</title>
	<atom:link href="http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/</link>
	<description>Programming is our passion</description>
	<lastBuildDate>Sat, 06 Mar 2010 19:35:52 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chris</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-209</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 27 Jul 2009 10:54:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-209</guid>
		<description>Move to ExtJS 3.0 and use the Asp.NET DirectHandler stack to accomplish this. 

It would not be a &#039;PageMethod&#039; perse&#039; but it will allow you to accomplish the functionality you&#039;re looking for.</description>
		<content:encoded><![CDATA[<p>Move to ExtJS 3.0 and use the Asp.NET DirectHandler stack to accomplish this. </p>
<p>It would not be a &#8216;PageMethod&#8217; perse&#8217; but it will allow you to accomplish the functionality you&#8217;re looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Lima</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-206</link>
		<dc:creator>Leonardo Lima</dc:creator>
		<pubDate>Fri, 24 Jul 2009 21:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-206</guid>
		<description>This code only works with MS SQL SERVER 2005 or better!</description>
		<content:encoded><![CDATA[<p>This code only works with MS SQL SERVER 2005 or better!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adding server side sorting to ExtJS Grid using WebMethods in ASP.NET &#124; .toString()</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-192</link>
		<dc:creator>Adding server side sorting to ExtJS Grid using WebMethods in ASP.NET &#124; .toString()</dc:creator>
		<pubDate>Fri, 27 Mar 2009 08:03:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-192</guid>
		<description>[...] How to add JavaScript WYSIWYG Editor ( Rich TextBox )in ASP.NET Website&#160;(14)How to use Log4net in ASP.NET Application&#160;(8)How to make pop-up / Notification bar with Message Ticker (smooth message scroller) over the Task Bar in C#.NET&#160;(7)On-Demand Paging using ExtJS Grid with Client-Centric ASP.NET AJAX (WebMethods)&#160;(7) [...]</description>
		<content:encoded><![CDATA[<p>[...] How to add JavaScript WYSIWYG Editor ( Rich TextBox )in ASP.NET Website&nbsp;(14)How to use Log4net in ASP.NET Application&nbsp;(8)How to make pop-up / Notification bar with Message Ticker (smooth message scroller) over the Task Bar in C#.NET&nbsp;(7)On-Demand Paging using ExtJS Grid with Client-Centric ASP.NET AJAX (WebMethods)&nbsp;(7) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-166</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 24 Feb 2009 05:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-166</guid>
		<description>Actually, this turned out to be a better implementation for the filters JSON.

&lt;code&gt;

            var sParams = &quot;(p.start,p.limit&quot;;
            var filt = [];
            var filterItems = &#039;&#039;;
            
            if(p.filters) {
                if(p.filters.getCount()&gt;0) {
                    filt = p.getFilterData();
                    if(filt.length&gt;0) {
                        var filters = {};
                        filters.gridFilters = [];
                        for(var i=0;i&lt;filt.length;i++){
                            filters.gridFilters.push(filt[i])
                        }
                        filterItems = Ext.encode(filters);
                    }
                }
            }
            
            sParams += &quot;,filterItems,this.handleResponse)&quot;;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Actually, this turned out to be a better implementation for the filters JSON.</p>
<p><code></p>
<p>            var sParams = "(p.start,p.limit";<br />
            var filt = [];<br />
            var filterItems = '';</p>
<p>            if(p.filters) {<br />
                if(p.filters.getCount()&gt;0) {<br />
                    filt = p.getFilterData();<br />
                    if(filt.length&gt;0) {<br />
                        var filters = {};<br />
                        filters.gridFilters = [];<br />
                        for(var i=0;i&lt;filt.length;i++){<br />
                            filters.gridFilters.push(filt[i])<br />
                        }<br />
                        filterItems = Ext.encode(filters);<br />
                    }<br />
                }<br />
            }</p>
<p>            sParams += ",filterItems,this.handleResponse)";<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-165</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 23 Feb 2009 05:09:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-165</guid>
		<description>Nevermind, I have it figured out. Basically add a param on the page method I call JSON (string).

&lt;code&gt;
// pagemethods-proxy.js changes
Ext.data.PageMethodProxy = function(config){
	Ext.data.PageMethodProxy.superclass.constructor.call(this);
	Ext.apply(this, config);
};

Ext.data.PageMethodProxy.TRANS_ID = 1000;
Ext.data.PageMethodProxy.arr_trans = Array();

Ext.extend(Ext.data.PageMethodProxy, Ext.data.DataProxy, {
    load : function(params, reader, callback, scope, arg) {
        if(this.fireEvent(&quot;beforeload&quot;, this, params) !== false){

            var p = Ext.apply(params, this.extraParams);
            var transId = ++Ext.data.PageMethodProxy.TRANS_ID;
            var sParams = &quot;(p.start,p.limit&quot;;
            var filt = [];
            var filterItems = &#039;&#039;;
            
            if(p.filters) {
                if(p.filters.getCount()&gt;0) {
                    filt = p.getFilterData();
                    if(filt.length&gt;0) {
                        for(var i=0;i&lt;filt.length;i++){
                            if(filterItems.length==0){
                                filterItems += &#039;{&quot;gridFilters&quot;:[&#039; + Ext.encode(filt[i]);
                            }else{
                                filterItems += &#039;, &#039; + Ext.encode(filt[i]);
                            }                           
                        }
                        filterItems += &#039;]}&#039;;
                    }
                }
            }
            
            sParams += &quot;,filterItems,this.handleResponse)&quot;;....

// PageMethod
[System.Web.Services.WebMethod(EnableSession = true)] 
public static HowToList GetHowTos(int PageNumber, int MaximumRows, string JSON) 
{ 
    
    HowToList howToList = new HowToList(); 
    HowToItem item = null; 
    JSONGridFilters filter = new JSONGridFilters(JSON); 
    string selekt = filter.GetFilter(); 
    
    DataTable dt = howToList.DataSource(selekt);........

// then my deserializer class looks like this

using System.Collections.Generic; 
using System.Web.Script.Serialization; 

// Example JSON{&quot;gridFilters&quot;:[{&quot;field&quot;:&quot;title&quot;,&quot;data&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;value&quot;:&quot;3d&quot;}}]} 

public class JSONGridFilters 
{ 
    private GridFilters _filters; 
    
    public JSONGridFilters(string JSON) 
    { 
        if (!string.IsNullOrEmpty(JSON)) { 
            JavaScriptSerializer jss = new JavaScriptSerializer(); 
            object test = jss.DeserializeObject(JSON); 
            
            if ((test) is Dictionary) { 
                Dictionary dict = (Dictionary)test; 
                if (dict.Count &gt; 0) { 
                    if (dict.ContainsKey(&quot;gridFilters&quot;)) { 
                        _filters = (GridFilters)jss.Deserialize(JSON); 
                    } 
                } 
            } 
        } 
    } 
    
    public string GetFilter() 
    { 
        StringBuilder sb = new StringBuilder(); 
        
        if ((_filters != null)) { 
            foreach (GridFilter f in _filters.gridFilters) { 
                if ((f.field != null) &amp;&amp; (f.data != null)) { 
                    if (sb.Length == 0) { 
                        sb.Append(f.field).Append(&quot; LIKE &#039;%&quot;).Append(f.data.value).Append(&quot;%&#039;&quot;); 
                    } 
                    else { 
                        sb.Append(&quot; AND &quot;).Append(f.field).Append(&quot; LIKE &#039;%&quot;).Append(f.data.value).Append(&quot;%&#039;&quot;); 
                    } 
                } 
            } 
        } 
        
        return sb.ToString(); 
        
    } 
} 


internal class GridFilters 
{ 
    public List gridFilters; 
} 

internal class GridFilter 
{ 
    public string field; 
    public FilterPair data; 
} 

internal class FilterPair 
{ 
    public string type; 
    public object value; 
} 

hope it helps someone. If you have a better way please let me know. cmschick @ comcast .net</description>
		<content:encoded><![CDATA[<p>Nevermind, I have it figured out. Basically add a param on the page method I call JSON (string).</p>
<p><code><br />
// pagemethods-proxy.js changes<br />
Ext.data.PageMethodProxy = function(config){<br />
	Ext.data.PageMethodProxy.superclass.constructor.call(this);<br />
	Ext.apply(this, config);<br />
};</p>
<p>Ext.data.PageMethodProxy.TRANS_ID = 1000;<br />
Ext.data.PageMethodProxy.arr_trans = Array();</p>
<p>Ext.extend(Ext.data.PageMethodProxy, Ext.data.DataProxy, {<br />
    load : function(params, reader, callback, scope, arg) {<br />
        if(this.fireEvent("beforeload", this, params) !== false){</p>
<p>            var p = Ext.apply(params, this.extraParams);<br />
            var transId = ++Ext.data.PageMethodProxy.TRANS_ID;<br />
            var sParams = "(p.start,p.limit";<br />
            var filt = [];<br />
            var filterItems = '';</p>
<p>            if(p.filters) {<br />
                if(p.filters.getCount()&gt;0) {<br />
                    filt = p.getFilterData();<br />
                    if(filt.length&gt;0) {<br />
                        for(var i=0;i&lt;filt.length;i++){<br />
                            if(filterItems.length==0){<br />
                                filterItems += '{"gridFilters":[' + Ext.encode(filt[i]);<br />
                            }else{<br />
                                filterItems += ', ' + Ext.encode(filt[i]);<br />
                            }<br />
                        }<br />
                        filterItems += ']}';<br />
                    }<br />
                }<br />
            }</p>
<p>            sParams += ",filterItems,this.handleResponse)";....</p>
<p>// PageMethod<br />
[System.Web.Services.WebMethod(EnableSession = true)]<br />
public static HowToList GetHowTos(int PageNumber, int MaximumRows, string JSON)<br />
{ </p>
<p>    HowToList howToList = new HowToList();<br />
    HowToItem item = null;<br />
    JSONGridFilters filter = new JSONGridFilters(JSON);<br />
    string selekt = filter.GetFilter(); </p>
<p>    DataTable dt = howToList.DataSource(selekt);........</p>
<p>// then my deserializer class looks like this</p>
<p>using System.Collections.Generic;<br />
using System.Web.Script.Serialization; </p>
<p>// Example JSON{"gridFilters":[{"field":"title","data":{"type":"string","value":"3d"}}]} </p>
<p>public class JSONGridFilters<br />
{<br />
    private GridFilters _filters; </p>
<p>    public JSONGridFilters(string JSON)<br />
    {<br />
        if (!string.IsNullOrEmpty(JSON)) {<br />
            JavaScriptSerializer jss = new JavaScriptSerializer();<br />
            object test = jss.DeserializeObject(JSON); </p>
<p>            if ((test) is Dictionary) {<br />
                Dictionary dict = (Dictionary)test;<br />
                if (dict.Count &gt; 0) {<br />
                    if (dict.ContainsKey("gridFilters")) {<br />
                        _filters = (GridFilters)jss.Deserialize(JSON);<br />
                    }<br />
                }<br />
            }<br />
        }<br />
    } </p>
<p>    public string GetFilter()<br />
    {<br />
        StringBuilder sb = new StringBuilder(); </p>
<p>        if ((_filters != null)) {<br />
            foreach (GridFilter f in _filters.gridFilters) {<br />
                if ((f.field != null) &amp;&amp; (f.data != null)) {<br />
                    if (sb.Length == 0) {<br />
                        sb.Append(f.field).Append(" LIKE '%").Append(f.data.value).Append("%'");<br />
                    }<br />
                    else {<br />
                        sb.Append(" AND ").Append(f.field).Append(" LIKE '%").Append(f.data.value).Append("%'");<br />
                    }<br />
                }<br />
            }<br />
        } </p>
<p>        return sb.ToString(); </p>
<p>    }<br />
} </p>
<p>internal class GridFilters<br />
{<br />
    public List gridFilters;<br />
} </p>
<p>internal class GridFilter<br />
{<br />
    public string field;<br />
    public FilterPair data;<br />
} </p>
<p>internal class FilterPair<br />
{<br />
    public string type;<br />
    public object value;<br />
} </p>
<p>hope it helps someone. If you have a better way please let me know. cmschick @ comcast .net</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-164</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sun, 22 Feb 2009 21:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-164</guid>
		<description>Absolutely beautiful. Thank you. However, I am trying to figure out how I can add the GridFilters plug-in filter value to the page method proxy. Any ideas?

Thanks.</description>
		<content:encoded><![CDATA[<p>Absolutely beautiful. Thank you. However, I am trying to figure out how I can add the GridFilters plug-in filter value to the page method proxy. Any ideas?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Irfan</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-77</link>
		<dc:creator>Irfan</dc:creator>
		<pubDate>Fri, 09 Jan 2009 23:40:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-77</guid>
		<description>as you cannot do it normal environment, you cannot do this using ExtJs</description>
		<content:encoded><![CDATA[<p>as you cannot do it normal environment, you cannot do this using ExtJs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: extjs_beginner</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-52</link>
		<dc:creator>extjs_beginner</dc:creator>
		<pubDate>Mon, 29 Dec 2008 20:30:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-52</guid>
		<description>So, can I use this to call a PageMethod from another page? For example, how would I call a page method from products.aspx, instead of default.aspx?</description>
		<content:encoded><![CDATA[<p>So, can I use this to call a PageMethod from another page? For example, how would I call a page method from products.aspx, instead of default.aspx?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Irfan</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-31</link>
		<dc:creator>Irfan</dc:creator>
		<pubDate>Thu, 18 Dec 2008 20:30:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-31</guid>
		<description>1. Many developers do not want to use WebServices in their project
2. In very large applications you cannot afford building WebService for each method
3. You are not required to build JSON at server end
4. This is just another approach :)</description>
		<content:encoded><![CDATA[<p>1. Many developers do not want to use WebServices in their project<br />
2. In very large applications you cannot afford building WebService for each method<br />
3. You are not required to build JSON at server end<br />
4. This is just another approach <img src='http://www.dottostring.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mankz</title>
		<link>http://www.dottostring.com/2008/12/on-demand-paging-using-extjs-grid-with-client-centric-asp-dot-net-ajax-webmethods/comment-page-1/#comment-30</link>
		<dc:creator>Mankz</dc:creator>
		<pubDate>Thu, 18 Dec 2008 16:31:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.dottostring.com/?p=181#comment-30</guid>
		<description>Why not use webservices instead? By using page methods you limit reusability, no other page can access your method. And you can skip the proxy thing with a web service approach (using the ScriptService attribute)</description>
		<content:encoded><![CDATA[<p>Why not use webservices instead? By using page methods you limit reusability, no other page can access your method. And you can skip the proxy thing with a web service approach (using the ScriptService attribute)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
