ObjectDataSource and Linq. Please, help! I don't know what else to try. Thank You.
- From: shapper <mdmoura@xxxxxxxxx>
- Date: Thu, 21 Feb 2008 18:57:39 -0800 (PST)
Hello,
I used a "Linq to SQL classes" in VS 2008 to map the tables of a
database: MyDbDataContext
One of the tables is named Tags and has 2 columns: TagID and Text.
This table is related to a second table named Articles through a table
ArticlesTags.
I would like to use an ObjectDataSource as a layer between my data and
a ListView.
In my page I created the following:
private void odsTags_Init(object sender, EventArgs e)
{
odsTags.ID = "odsTags";
odsTags.SelectMethod = "GetTags";
odsTags.TypeName = "MyDbDataContext";
}
public static ICollection GetTags()
{
MyDbDataContext database = new MyDbDataContext();
var query = from t in db.Tags
select new
{
TagId = t.TagId,
TagText = t.TagText,
Active = t.ArticlesTags.Any
};
return tags;
}
I get the following error:
ObjectDataSource 'odsTags' could not find a non-generic method
'GetTags' that has no parameters.
I have no idea what I am doing wrong. I am not able to solve it!
I tried to Google for a solution but I didn't find it. I don't know
what I am doing wrong.
This is the first time I use an ObjectDataSource with a Linq
DataContext.
Thanks,
Miguel
.
- Follow-Ups:
- Re: ObjectDataSource and Linq. Please, help! I don't know what else to try. Thank You.
- From: Jon Skeet [C# MVP]
- Re: ObjectDataSource and Linq. Please, help! I don't know what else to try. Thank You.
- Prev by Date: Re: .NET 2, Win98
- Next by Date: Re: Does String.Replace always recreate a new string object?
- Previous by thread: ReportViewer whoas...
- Next by thread: Re: ObjectDataSource and Linq. Please, help! I don't know what else to try. Thank You.
- Index(es):
Relevant Pages
|