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 VelayuthamRank #413 · 6K reputationPosted Nov 22, 2010, 2:33 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 22, 2010, 2:04 AM EST
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);
Manikavelu VelayuthamRank #413 · 6K reputationPosted Nov 22, 2010, 2:28 AM EST
Hope this link will help you convert the return type,.
Ajay Kumar7 reputationPosted Nov 22, 2010, 2:29 AM EST
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...