将城市名称替换为“城市”

时间:2018-08-07 18:18:06

标签: asp.net

我正在从SQL Server检索数据到ASP.Net中的网格视图。下面是我从数据库中检索数据后的网格视图的标题。

Time| Atlanta_1| Atlanta_2| Atlanta_3|

我想动态地将城市名称替换为“城市”,例如

Time| City_1| City_2| City_3|

所以基本上,我想用“ City”替换标题的一部分,并且要在网格视图中绑定而不是在SQL Server中进行绑定。下面是我如何从数据库检索数据到我的gridview的代码

SqlConnection con = new SqlConnection("My Connection");

string s = "My Stored Procedure";

con.Open();
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();

da.Fill(ds);

gridView1.DataSource = ds;
gridView1.DataBind();

con.Close();

1 个答案:

答案 0 :(得分:2)

您可以使用RowDataBound事件。然后循环所有标题单元格。检查单元格中的(check-sat-using (then (using-params simplify :arith-lhs true :som true) propagate-values normalize-bounds lia2pb pb2bv bit-blast sat)) 并替换为正确的值。如果始终为_,则可以执行替换操作。

Atlanta
相关问题