WHAT'S HOT
Prev | Current Page 321 | Next

Satheesh, N Kumar

"LINQ Quickly"

We can see the web page with the
drop-down list loaded with a list of categories as shown in the following figure:
You will also need to write code for getting items for the selected category that form
the drop-down list. Add the following code to the Get Items button control:
protected void Button1_Click(object sender, EventArgs e)
{
GridView1.DataSource = from items in dataBase.Items
join categories in dataBase.Categories on items.CategoryID
equals categories.CategoryID
where categories.Category == DropDownList1.SelectedValue.ToString()
select new { items.Name, items.Categories.Category,
items.Protein, items.Ingredients };
GridView1.DataBind();
Appendix A
[ 227 ]
int iCount = (from items in dataBase.Items
join categories in dataBase.Categories on items.CategoryID
equals categories.CategoryID
where categories.Category == DropDownList1.SelectedValue.ToString()
select new { items.Name, items.Categories.Category,
items.Protein, items.Ingredients }).Count();
if (iCount > 0)
{
lblCount.


Pages:
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
aquilamed Spa Ciechocinek drzwiowe hosting hotele londyn