当前位置: 代码迷 >> ASP.NET >> 问一个关于GridView的有关问题,希望大家能帮帮忙啊多谢
  详细解决方案

问一个关于GridView的有关问题,希望大家能帮帮忙啊多谢

热度:3537   发布时间:2013-02-25 00:00:00.0
问一个关于GridView的问题,希望大家能帮帮忙啊,谢谢
手动配置数据源时GridView不能自动分页,怎么办啊?
后台是这样写的:
    if   (!IsPostBack)
                {
                        string   a   =   Session[ "textbox "].ToString();

                        Label1.Text   =   a;
                        OleDbConnection   conn   =   new   OleDbConnection(@ "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   +   Server.MapPath( "db1.mdb "));
                        string   sql   =   "select   *   from   goods   where   goodsvariety   like   '% "   +   a   +   "% '   or   goodsname   like   '% "   +   a   +   "% '     or   goodsoprice   like   '% "   +   a   +   "% '   or   goodsnprice   like   '% "   +   a   +   "% ' ";
                        string   sql1   =   "select   *   from   goods   where   goodsvariety   like   '% "   +   a   +   "% '   or   goodsname   like   '% "   +   a   +   "% ' ";
                        OleDbDataAdapter   da   =   new   OleDbDataAdapter(sql,   conn);
                        OleDbDataAdapter   da1   =   new   OleDbDataAdapter(sql1,   conn);
                        DataSet   ds   =   new   DataSet();
                        DataSet   ds1   =   new   DataSet();

                        System.Text.RegularExpressions.Regex   re   =   new   System.Text.RegularExpressions.Regex(@ "[0-9] ",   System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        if   (re.Matches(a).Count   ==   a.Length)
                        {
                                conn.Open();
                                da.Fill(ds,   "textbox ");
                                GridView1.DataSourceID   =   null;
                                GridView1.DataSource   =   ds.Tables[ "textbox "].DefaultView;
                                DataBind();
                                conn.Close();
  相关解决方案