标签:man request 数据 text label null new his inf
页面:
<asp:Label ID="lblId" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblClick" runat="server" Text="Label"></asp:Label>
后台:
if (!IsPostBack) {
int id = Convert.ToInt32(Request["id"]);
Books books = null;
if (Cache["Books_" + id] != null) {
//从内存中读取
books = Cache["Books_" + id] as Books;
}
else
{
//请求数据库
books = new BooksManager().getIdBooksInfo(id);
if (books!=null&&books.Clicks>200)
{
//添加应用程序缓存
Cache["Books_" + id] = books;
}
}
if (books!=null)
{
this.lblId.Text = Convert.ToString(books.Id);
this.lblTitle.Text = books.Title;
this.lblClick.Text = Convert.ToString(books.Clicks);
}
标签:man request 数据 text label null new his inf
原文地址:http://www.cnblogs.com/pinkyZhou/p/7067854.html