﻿<?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 - Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</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>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Thu, 02 May 2013 05:58:18 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi zxdluck,&lt;/p&gt;&lt;p&gt;Glad that you have solved your problem. If you have any further question, please don't hesitate to ask us.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Bernard&lt;/p&gt;</description></item><item><title>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Wed, 01 May 2013 23:25:44 GMT</pubDate><dc:creator>zxdluck</dc:creator><description>&lt;p&gt;Hi Bernard,&lt;/p&gt;
&lt;p&gt;Thanks for your sample,and depending on your sample,I just know my error now,thank you very much!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item><item><title>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Mon, 29 Apr 2013 05:10:50 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi zxdluck,&lt;/p&gt;&lt;p&gt;I tried to replicate your issue in my local end. But unfortunately, I couldn't replicate the issue in my local end. I have made my sample to programmatically rendered. I attach the sample here. Could you check my sample and please let me know if there's any error in my sample. Look forward to hear any feedback from you so I can help you further.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Bernard&lt;/p&gt;</description></item><item><title>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Fri, 26 Apr 2013 23:48:24 GMT</pubDate><dc:creator>zxdluck</dc:creator><description>&lt;p&gt;Hi Bernard,&lt;/p&gt;
&lt;p&gt;Thank you very much for your sample, and I ran it ,it executed successfully, and I know, use DataSource control it can work fine. But my doubt is that I didn't use DataSource control to bind the grid,I just use WebGrid1_InitializeLayout and WebGrid1_PrepareDataBinding above,and set the CategoryID valueList in WebGrid1_PrepareDataBinding, just see the attachement in  previous topic, it cause error, so I wonder if it should use datasource control to bind the grid and valuelist,or it may cause error?  the following is my code,Thank you !&lt;/p&gt;
&lt;p&gt; protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)&lt;br&gt;&lt;/br&gt;        {&lt;br&gt;&lt;/br&gt;            e.DataSource = service.GetProducts();&lt;br&gt;&lt;/br&gt;        }&lt;/p&gt;
&lt;p&gt;        protected void WebGrid1_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e)&lt;br&gt;&lt;/br&gt;        {&lt;br&gt;&lt;/br&gt;            if (!IsPostBack)&lt;br&gt;&lt;/br&gt;            {&lt;br&gt;&lt;/br&gt;                WebGrid1.RetrieveStructure();&lt;br&gt;&lt;/br&gt;            }&lt;br&gt;&lt;/br&gt;            WebGrid1.RootTable.Columns.GetNamedItem("CategoryID").UseValueListForSorting = ValueListSorting.Yes;&lt;br&gt;&lt;/br&gt;            WebValueList v1 = WebGrid1.RootTable.Columns.GetNamedItem("CategoryID").ValueList;&lt;br&gt;&lt;/br&gt;            if (!v1.IsDataCached())&lt;br&gt;&lt;/br&gt;            {&lt;br&gt;&lt;/br&gt;                DataTable dt = service.GetCategories();&lt;br&gt;&lt;/br&gt;                v1.DataSource = dt;&lt;br&gt;&lt;/br&gt;            }&lt;br&gt;&lt;/br&gt;            //v1.DataMember = "Categories";&lt;br&gt;&lt;/br&gt;            v1.DataTextField = "CategoryName";&lt;br&gt;&lt;/br&gt;            v1.DataValueField = "CategoryID";&lt;br&gt;&lt;/br&gt;        }&lt;/p&gt;
&lt;p&gt;        protected void WebGrid1_InitializeLayout(object sender, ISNet.WebUI.WebGrid.LayoutEventArgs e)&lt;br&gt;&lt;/br&gt;        {&lt;br&gt;&lt;/br&gt;            WebGrid1.RootTable.Columns.GetNamedItem("CategoryID").UseValueListForSorting = ValueListSorting.Yes;&lt;br&gt;&lt;/br&gt;            WebValueList v1 = WebGrid1.RootTable.Columns.GetNamedItem("CategoryID").ValueList;&lt;br&gt;&lt;/br&gt;            if (!v1.IsDataCached())&lt;br&gt;&lt;/br&gt;            {&lt;br&gt;&lt;/br&gt;                DataTable dt = service.GetCategories();&lt;br&gt;&lt;/br&gt;                v1.DataSource = dt;&lt;br&gt;&lt;/br&gt;            }&lt;br&gt;&lt;/br&gt;            //v1.DataMember = "Categories";&lt;br&gt;&lt;/br&gt;            v1.DataTextField = "CategoryName";&lt;br&gt;&lt;/br&gt;            v1.DataValueField = "CategoryID";&lt;/p&gt;
&lt;p&gt;        }&lt;/p&gt;
&lt;p&gt;        protected void WebGrid1_CustomFilter(object sender, FilterEventArgs e)&lt;br&gt;&lt;/br&gt;        {&lt;br&gt;&lt;/br&gt;            WebGridFilter filter;&lt;br&gt;&lt;/br&gt;            filter = e.FilterColumns.GetNamedItem("CategoryName");&lt;br&gt;&lt;/br&gt;            if (filter != null)&lt;br&gt;&lt;/br&gt;                e.FilterColumns.Remove(filter);&lt;/p&gt;
&lt;p&gt;            WebGridFilter oldFilter;&lt;br&gt;&lt;/br&gt;            oldFilter = e.FilterColumns.GetNamedItem("CategoryID");&lt;br&gt;&lt;/br&gt;            if (oldFilter != null)&lt;br&gt;&lt;/br&gt;            {&lt;br&gt;&lt;/br&gt;                e.FilterColumns.Remove(oldFilter);&lt;br&gt;&lt;/br&gt;                filter = new WebGridFilter();&lt;br&gt;&lt;/br&gt;                filter.Table = oldFilter.Table;&lt;br&gt;&lt;/br&gt;                // remember to set column member field BEFORE FilterType and FilterText&lt;br&gt;&lt;/br&gt;                filter.ColumnMember = "CategoryName";&lt;br&gt;&lt;/br&gt;                filter.FilterType = oldFilter.FilterType;&lt;br&gt;&lt;/br&gt;                filter.FilterText = oldFilter.FilterText;&lt;br&gt;&lt;/br&gt;                e.FilterColumns.Add(filter);&lt;br&gt;&lt;/br&gt;            }&lt;/p&gt;
&lt;p&gt;        }&lt;/p&gt;</description></item><item><title>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Fri, 26 Apr 2013 04:16:22 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi zxdluck,&lt;/p&gt;&lt;p&gt;Actually, there are some error in in our walkthrough. In your sample, the issue happen because it search for CategoryName column that doesn't exists in your RootTable. Since you set table property for the filter as WebGrid1's root table, WebGrid will return error which said that WebGrid couldn't find the object. I've made you a simple sample regarding Custom Filter in WebGrid. You can look for the code in there. For references, please visit: &lt;a href="http://www.intersoftpt.com/Support/WebGrid/KB/All/5/#permalink=Create-a-custom-filter-on-WebGrid" style="font-size: 10pt;"&gt;http://www.intersoftpt.com/Support/WebGrid/KB/All/5/#permalink=Create-a-custom-filter-on-WebGrid&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Bernard&lt;/p&gt;</description></item><item><title>Webgrid using CustomFilter issue</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Webgrid-using-CustomFilter-issue/</link><pubDate>Thu, 25 Apr 2013 01:02:28 GMT</pubDate><dc:creator>zxdluck</dc:creator><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;When I want to realize customfilter function by using WebGrid1_CustomFilter event,I did it as the sample &lt;em&gt;"&lt;span id="pagetitle"&gt;Walkthrough: Applying custom filtering in WebGrid &lt;/span&gt;",&lt;/em&gt;but finally,it make errors,the error prompt "&lt;em&gt;Object reference not set to an object instance&lt;/em&gt;",the attachment is my sample,would please have a look,and help me to find the answer to the problem, Thank you very much!&lt;/p&gt;</description></item></channel></rss>