网格视图布局编辑问题 [英] Grid View Layout Editing Problem
本文介绍了网格视图布局编辑问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用
I Used
<column>
<asp:BoundField DataField="UFName"; HeaderText="First Name"; ItemStyle-Width="150px";>
</column>
它仍显示gridview中的默认标题行。我想要帮助。显示按钮上的代码如下
it still show the default header row in the gridview. i want help please. codes on show button are the following
protected void btnShow_Click(object sender, EventArgs e)
{
string conStr = ConfigurationManager.ConnectionStrings["CStringCRM"].ToString();
DataTable dt = new DataTable();
SqlDataReader dr = null;
using (SqlConnection conn = new SqlConnection(conStr))
{
// Creating insert statement
string sql = string.Format(@"SELECT * FROM User");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
conn.Open();
dr = cmd.ExecuteReader();
dt.Load(dr);
conn.Close();
cmd = null;
}
推荐答案
为Gridview设置AutoGenerateColumns =false。
set AutoGenerateColumns="false" for the Gridview.
这篇关于网格视图布局编辑问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文