protected void btnSearch_ClickLINQ(object sender, EventArgs e) { BooklistDataContext context = new BooklistDataContext(SPContext.Current.Web.Url); List <BookView> bookList = (from B in context.Books where B.Author == ddlAuthor.SelectedValue select new BookView { Title = B.Title, Author = B.Author }).ToList(); gvResults.DataSource = bookList; gvResults.DataBind(); }
protected void PopulateAuthorListLINQ() { BooklistDataContext context = new BooklistDataContext(SPContext.Current.Web.Url); var authorList = (from B in context.Books select B.Author); foreach (string author in authorList) { ddlAuthor.Items.Add(author); } //ddlAuthor.DataSource = authorList; //ddlAuthor.DataBind(); }