日期:2014-05-20 浏览次数:20902 次
<%@ Page Language="C#" %> <%@ Import Namespace="System.Xml" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Data.OleDb" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Net" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { String ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|MengXianhui.mdb;"; OleDbConnection cn = new OleDbConnection(ConnectionString); cn.Open(); OleDbCommand cmd = new OleDbCommand("Select Title From [Document]", cn); GridView1.DataSource = cmd.ExecuteReader(); GridView1.DataBind(); cn.Close(); } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (DataBinder.Eval(e.Row.DataItem, "Title").ToString().IndexOf("的") > -1) { e.Row.Visible = false; } } } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> </head> <body> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound"> </asp:GridView> </form> </body> </html>
------解决方案--------------------
e.Row.Visible = false;
貌似可以的
------解决方案--------------------