tag:blogger.com,1999:blog-2297698770491701674.post2012677097749491509..comments2023-06-01T09:20:01.001-07:00Comments on Code On Time: Server-Side Data FiltersCustomer Servicehttp://www.blogger.com/profile/04471166550881539854noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-2297698770491701674.post-14575772562584669082010-09-23T11:53:52.135-07:002010-09-23T11:53:52.135-07:00You need to link your class to the data controller...You need to link your class to the data controller through "handler" attribute.<br /> <br />We suggest that you consider using view filters instead as described at http://blog.codeontime.com/2010/05/sort-and-filter.htmlCustomer Servicehttps://www.blogger.com/profile/04471166550881539854noreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-33448467101140634642010-09-06T14:11:06.327-07:002010-09-06T14:11:06.327-07:00Tried to load the Class1 but still no filtering. W...Tried to load the Class1 but still no filtering. Where exactly is the code added to,i added it to my page codebehind but it doesnt seem to be called?<br /><br /> public class Class1 : IDataFilter<br /> {<br /><br /> public void Filter(SortedDictionary filter)<br /> {<br /> int FormNo;<br /> if (HttpContext.Current.Session["FormNo"] == null)<br /> {<br /> FormNo = Convert.ToInt32('8');<br /> }<br /> else<br /> {<br /> FormNo =Convert.ToInt32(HttpContext.Current.Session["FormNo"]);<br /> <br /> }<br /> filter.Add("FormNo", FormNo);<br /> <br /> }<br /> }ajnarhttps://www.blogger.com/profile/15128269550395007327noreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-53291376301442264702009-02-16T02:11:00.000-08:002009-02-16T02:11:00.000-08:00I have tried creating IDataFilter interface in Com...I have tried creating IDataFilter interface in Common.vb <BR/> <BR/>Public Interface IDataFilter<BR/> Sub Filter(ByVal filter As SortedDictionary(Of String, Object)) <BR/> End Interface<BR/><BR/>And then I created Class1 following your tutorial and also made change to the controller.xml file, also tried to pass the values using session variables. But still no filteration is available. <BR/><BR/>Is the files created using your premium subscription is different from that created using your free version?Pravin Jhahttps://www.blogger.com/profile/14009560905204989347noreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-81385759340048519992009-02-13T21:37:00.000-08:002009-02-13T21:37:00.000-08:00Pravin,You don't have to create an instance of...Pravin,<BR/><BR/>You don't have to create an instance of Class1 explicitly. Simply modify dataController element to include the class name in dataFilterType attribute:<BR/><BR/><dataController name="Orders" ... dataFilterType="Class1"><BR/><BR/>The class instance is automatically created when data is about to be returned to the client. You can communicate with the class via Session object. <BR/><BR/>For example, in your *.aspx page assign values to session variables EmployeeID and ShipVia:<BR/><BR/> Protected Sub Button1_Click(ByVal sender As Object, _<BR/> ByVal e As System.EventArgs) Handles Button1.Click<BR/> Session("EmployeeID") = 45<BR/> Session("ShipVia") = 2<BR/> End Sub<BR/><BR/>Use session variables as in this example:<BR/><BR/>Imports System.Collections.Generic<BR/>Imports MyCompany.Data<BR/><BR/>Public Class Class1<BR/> Implements IDataFilter<BR/><BR/> Public Sub Filter(ByVal filter As SortedDictionary(Of String, Object)) _<BR/> Implements MyCompany.Data.IDataFilter.Filter<BR/> filter.Add("EmployeeID", HttpContext.Current.Session("EmployeeID"))<BR/> filter.Add("ShipVia", HttpContext.Current.Session("ShipVia"))<BR/> End Sub<BR/>End ClassAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-22596691047633076802009-02-12T23:12:00.000-08:002009-02-12T23:12:00.000-08:00Can you please show me the code where you may have...Can you please show me the code where you may have created a instance to the class "Class1" and passed filters to "EmployeeId" and "ShipVia" fields.Pravin Jhahttps://www.blogger.com/profile/14009560905204989347noreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-7551207684301366682008-10-29T15:55:00.000-07:002008-10-29T15:55:00.000-07:00Server-side data filters are supported in Data Aqu...Server-side data filters are supported in Data Aquarium Framework, which is available to premium project subscribers only.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-63914993858022327392008-10-29T14:02:00.000-07:002008-10-29T14:02:00.000-07:00Where is the IDataFilter class located. I download...Where is the IDataFilter class located. I downloaded the latest version of the CodeGenerator and I Don't have access to the Interface. <BR/><BR/>Thanks :)oumiller21https://www.blogger.com/profile/07001877258377532925noreply@blogger.comtag:blogger.com,1999:blog-2297698770491701674.post-33728929889281341882008-10-21T20:11:00.000-07:002008-10-21T20:11:00.000-07:00Can you provide an example of this?In a real-world...Can you provide an example of this?<BR/><BR/>In a real-world scenario you will likely use HttpContext.Current.User.Identity property or HttpContext.Current.User.IsInRole method to determine the scope of data that you want to include in the result set displayed to a currently signed in user. Make sure to add System.Web namespace to the list of namespaces in your data filter to get access to HttpContext.Current property.Anonymousnoreply@blogger.com