日期:2011-12-28  浏览次数:20591 次

首先创建类库 Model (业务实体层),创建类: NewDina.CS 用于获取数据库相应字段名,

Demo如下:

    public class NewDina
    {
        #region Fields
        private string _news_Title = String.Empty;
        private string _news_Content = String.Empty;
        private string _news_Time;
        #endregion
        Public Properties#region Public Properties
        public string news_Title
        {
            get { return _news_Title; }
            set { _news_Title = value; }
        }
        public string news_Content
        {
            get { return _news_Content; }
            set { _news_Content = value; }
        }
        public string news_Time
        {
            get { return _news_Time; }
            set { _news_Time = value; }
        }
        
        #endregion
    }

然后再创建一个类inaSet.CS该列用于将搜索的关键字放入数组,用于替换关键字用,令搜索的关键字显红色;

Demo如下:

    public class DinaSet
    {
        private ArrayList dinarray = new ArrayList();
        public ArrayList Dinarray
        {
            get
            {
                return dinarray;
            }
        }
    }

类创建好之后就是界面设计了,

Demo如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <asp:Button ID="btnSearch" runat="se