Search.aspx.cs

(完整代码) 1KB

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Search : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataAccess MarketBase = new DataAccess();
            SqlConnection conn = new SqlConnection(MarketBase.SqlBase);
            conn.Open();
            DataTable dt_sort = new DataTable();
            dt_sort = MarketBase.DisPlayList_Ds("select * from InfoType", conn);
            DropFenlei.DataTextField = "TypeName";
            DropFenlei.DataValueField = "TypeID";
            DropFenlei.DataSource = dt_sort.DefaultView;
            DropFenlei.DataBind();
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string Key;

        if (txtKeyword.Text == "" || txtKeyword.Text == null)
        {
            // Response.Write("<script>alert('请填写要查询的内容')</script>");
            infolabel.Text = "请填写要查询的内容";
        }
        else
        {

            Key = txtKeyword.Text;

            Response.Redirect("SearchResult.aspx?KeyWords=" + Key + "&&sort=" + DropFenlei.SelectedValue );

        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。