📄 aggregatesearchlist.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for AggregateSearchList.
/// </summary>
public class AggregateSearchList : WeblogBaseTemplatedWebControl
{
public AggregateSearchList()
{
}
AggregateList posts = null;
Literal title = null;
protected override void AttachChildControls()
{
posts = FindControl("Posts") as AggregateList;
title = FindControl("title") as Literal;
posts.PagerIndexChanged +=new EventHandler(posts_PagerIndexChanged);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if ( !Page.IsPostBack || !EnableViewState )
{
DataBind();
}
}
public override void DataBind()
{
base.DataBind ();
string q = Context.Request.QueryString["q"];
if(!Globals.IsNullorEmpty(q))
{
int groupID = Globals.SafeInt(Context.Request.QueryString["GroupID"],-1);
SearchQuery query = SearchQuery.FirstPageQuery(q);
query.PageIndex = posts.PageIndex;
if(groupID > -1)
query.GroupToSearch = new string[]{groupID.ToString()};
WeblogSearch search = new WeblogSearch();
SearchResultSet results = search.GetSearchResults(query);
posts.TotalRecords = results.TotalRecords;
posts.DataSource = results.Posts;
posts.DataBind();
title.Text = string.Format(ResourceManager.GetString("Weblog_SearchResult_Message"),results.TotalRecords,results.SearchDuration);
}
}
private void posts_PagerIndexChanged(object sender, EventArgs e)
{
DataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -