Aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PR9.aspx.cs" Inherits="WebApplication1.PR9" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>
aspx.cs:
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
namespace WebApplication1
{
public partial class PR9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<book_data> books = book_data.GetBooks();
varbooktitles = from t1 in books select t1.Title;
foreach (var title in booktitles)
Label1.Text += String.Format("{0} <br/>", title);
}
}
}
OUTPUT:
0 Comments