C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Sunday, September 9, 2012

Need help in VS 2010 LightSwitch


I am using VS 2010 LightSwitch in my application and want to apply filter using Preprocess query on some condition basis.
Like, i want to pass a global variable to that preprocess query to apply filter.
Code in Application.cs 
 public partial class Application
    {
        public static string  filterType;
    }
Code in ApplicationDataService.cs
 partial void EmployeesSet_All_PreprocessQuery(ref IQueryable<Employees> query)
        {
string filterType = this.Application.filterType; //// THIS LINE IS GIVING ERROR. But this is possible in code behind of screen. Any different approx to access global variable?

            if (filterType == "Name")

            {

                query = query.OrderBy(t => t.Name);

            }

            else

            {

                query = query.Where(t => (t.Age < 28));

            }

        }
 
But, I am not able to access global variable filtertype from table code ApplicationDataService.cs.
Please suggest any way to implement this.

SOLUTION 1:

No comments:

Post a Comment