Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Used
XML
<column>
     <asp:BoundField DataField="UFName"; HeaderText="First Name"; ItemStyle-Width="150px";>      
</column>


it still show the default header row in the gridview. i want help please. codes on show button are the following

XML
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;

            }
Posted

1 solution

set AutoGenerateColumns="false" for the Gridview.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900