📄 aggregatesearch.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;
namespace CommunityServer.Blogs.Controls
{
/// <summary>
/// Summary description for AggregateSearch.
/// </summary>
public class AggregateSearch : WeblogBaseTemplatedWebControl
{
public AggregateSearch()
{
//
// TODO: Add constructor logic here
//
}
private TextBox SearchBox = null;
private LinkButton SearchButton = null;
private RadioButtonList RadioGroup = null;
//private HtmlGenericControl RadioListItem = null;
protected override void AttachChildControls()
{
SearchBox = FindControl("SearchBox") as TextBox;
SearchButton = FindControl("SearchButton") as LinkButton;
RadioGroup = FindControl("RadioGroup") as RadioButtonList;
string q = Context.Request.QueryString["q"];
if(!Page.IsPostBack && Globals.IsNullorEmpty(q))
{
SearchBox.Text = q;
}
int groupID = Globals.SafeInt(Context.Request.QueryString["GroupID"],-1);
if(groupID > -1)
{
if(!Page.IsPostBack)
{
ListItem li = RadioGroup.Items.FindByValue("1");
if(li != null)
{
li.Selected = true;
Group g = WeblogGroups.GetWeblogGroup(groupID,true,false);
if(g != null)
li.Text = ResourceManager.GetString("Group");
}
}
}
FindControl("GroupFilter").Visible = (groupID > -1);
SearchButton.Click +=new EventHandler(SearchButton_Click);
SearchButton.CausesValidation = false;
}
private void SearchButton_Click(object sender, EventArgs e)
{
string q = SearchBox.Text;
if(!Globals.IsNullorEmpty(q))
{
int groupID = Globals.SafeInt(Context.Request.QueryString["GroupID"],-1);
if(groupID > -1)
{
ListItem li = RadioGroup.Items.FindByValue("1");
if(li != null)
{
if(!li.Selected)
groupID = -1;
}
}
Context.Response.Redirect(BlogUrls.Instance().AggregateSearch(q,1, groupID));
Context.Response.End();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -