I have a DataTable "Items" in my SQL server Database "Procurement"
The DataTable has 3 columns with this schema: id (int), itemDesc (nvarchar), itemCat (int) which is bind to a DataGridView using this code:
namespace EF_Tutorial
{
public partial class Form1 : Form
{
ProcurmentsEntities ProcurmetsContext = new ProcurmentsEntities();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
dgv_ItemList.DataSource = ProcurmetsContext.Items.ToList();
}
}
}
Problem is when the form loads the DataGridView shows the column name as it is in the DataTable, I tried adding the columns manually to the DGV and changed their name to that of the DataTable and the Header Text to what I want to display but the columns are generated and the one I added are left blank.
Is there a work around to display the name I want ?