Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 780.1k

GridView in ASP.NET

Sep 19 2013 1:32 AM
Sir, I am working with asp.net Grid.

My issue is that Grid is not displaying on page load in case of  no data in sql Table.

But Grid is showing on page load when i inserted data into table.

can display Grid without data in it?, if can, please send me the code.

Here the code I do:-

public void GridFill()
        {
            DA = new SqlDataAdapter("select * from tbl_Employee", sqlCon);
            dtbl = new DataTable();
            DA.Fill(dtbl);
            cmdbuilder = new SqlCommandBuilder(DA);
            gvEmployee.DataSource = dtbl;
            gvEmployee.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridFill();
            }
        }

Please help me in this topic.

Answers (6)