My data grid is not showing up in my webpage at all.As in no table showing up. I did follow this stack question and modified some of its code to suit mine,but it's not showing at all.
here is the code for my class which is triggered by the button.
private void LoadDataGrid()
{
con.Open();
cmd = new SqlCommand(@"SELECT quotationID,quo_product
FROM JobQuotations
WHERE quo_custname = @custname", con);
cmd.Parameters.AddWithValue("@custname",lblLoginName.Text);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
GridView1.DataSource = dt;
GridView1.DataBind();
con.Close();
}
and I have inserted it inside the page_load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadDataGrid();
}
}
here is the markup:
<asp:GridView ID="GridView1" runat="server"></asp:GridView>