在网格视图中搜索 [英] Search In Grid View

查看:67
本文介绍了在网格视图中搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void SearchData()
  {
    try
    {
      SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ToString());
      con.Open();
      SqlDataAdapter ad = new SqlDataAdapter("Select SrNo,Name,Convert(varchar,Birth,103)as Birth ,Age from Rnd",
                          con);
      DataSet ds = new DataSet();
      ad.Fill(ds, "Rnd");
      con.Close();
      GridView1.DataSource = ds.Tables["Rnd"];
      GridView1.DataBind();
    }
    catch (Exception exec)
    {
      ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Message", "alert(''" + exec.ToString() + "'')", true);
    }


}


}

推荐答案

不,上面的代码在gridview中不执行任何搜索".

它不搜索任何特定内容并返回也不存在任何过滤器代码.

您尝试了什么吗?
No, the above code does not do any ''search'' in gridview.

It does not search anything specific and return nor any filter code present.

Did you try anything?


没有问题,并从标题中删除了((是对的))".我们无法告诉您您的代码是否正确",因为我们没有(也不想要)您的所有代码.如果可以编译,请在调试器下运行它.如果不正确,您很快就会知道.
Not a question, and removed "(Is it right)" from title. We can''t tell you if your code is "right", because we don''t have (nor do we want) all of your code. If it compiles, run it under the debugger. If it''s not right, you''ll know in short order.


这篇关于在网格视图中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆