网格视图布局编辑问题

问题描述:

我使用

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.