git-svn-id: https://abrams/svn/LanSpider-repo@22 16f2e333-51b0-4855-8c5a-a66b7be24171
[LanSpider.git] / WebSearch / Default.aspx.cs
blobbf9f0a05d5db1888a251d3803c9ee9fefd8176a0
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.UI;
6 using System.Web.UI.WebControls;
8 public partial class _Default : System.Web.UI.Page
10 protected void Page_Load(object sender, EventArgs e)
12 string searchMask = Request.QueryString["q"];
13 if (!String.IsNullOrEmpty(searchMask))
15 Search(searchMask);
17 else
19 ListView1.DataSource = null;
20 ListView1.DataBind();
24 protected void Search(string searchMask)
26 SearchEngine se = new SearchEngine();
27 ListView1.DataSource = se.Search(searchMask);
28 ListView1.DataBind();
31 protected void btnSearch_Click(object sender, EventArgs e)
33 if (!String.IsNullOrEmpty(this.TextBox1.Text))
34 Response.Redirect(String.Format("~/Default.aspx?q={0}", this.TextBox1.Text));
37 protected override void OnInit(EventArgs e)
39 base.OnInit(e);
40 if (this.IsPostBack && (Request.Params["__EVENTTARGET"] == btnSearch.UniqueID))
41 Response.Redirect("~/Default.aspx?q=" + this.Server.UrlEncode(Request.Params[TextBox1.UniqueID]));