Problem in calling Linq method which return group by result on page load
Hi,
I hv method in class file and i need to call it on page load...I just want to knw what shud be exact return type here...
public static void GetPaymentGroupBy()
{
DataClasses1DataContext obj = new DataClasses1DataContext();
var query = (from pay in obj.GetTable<Payplan_Installment>()
group pay.Frequency by
new
{
pay.InstallmentAmount,
pay.PaymentMode,
pay.PlanStatus
} into details
select details);
}
===
I m calling on page load like this:
dataGridView1.DataSource = DataClasses1DataContext.GetPaymentGroupBy();
please help me,it is very urgent
Thanks in advance
Manikavelu VelayuthamPosted Nov 22, 2010, 7:33 AM
Ajay KumarPosted Nov 22, 2010, 7:29 AM
It is showing error like this:
Error 1 The type or namespace name 'GridView' could not be found (are you missing a using directive or an assembly reference?) D:\Work\testlinq\testlinq\DataClasses1.cs 381 43 testlinq
can u help me in this...
Manikavelu VelayuthamPosted Nov 22, 2010, 7:28 AM
Hope this link will help you convert the return type,.
Madhu KPosted Nov 22, 2010, 7:04 AM
public static void GetPaymentGroupBy(GridView gv)
{
DataClasses1DataContext obj = new DataClasses1DataContext();
var query = (from pay in obj.GetTable<Payplan_Installment>()
group pay.Frequency by
new
{
pay.InstallmentAmount,
pay.PaymentMode,
pay.PlanStatus
} into details
select details);
gv.DataSource = query;
gv.DataBind();
}
DataClasses1DataContext.GetPaymentGroupBy(dataGridView1);