2
Answers

ASP.NET Gridview Databind

Ask a question
kevin Thomas

kevin Thomas

14y
4.6k
1

I have written the following code to databind a gridview control on an asp website. When I step through the code the dataview shows that it had rows and columns the databind method executes but the gridview is not visible on my webpage.
if (!IsPostBack)
{
DataSet ds = GetData();
if (ds.Tables.Count > 0)
{
DataView dv = new DataView(ds.Tables[0]);
GridView1.DataSource = dv;
GridView1.Visible =
true;
GridView1.DataBind();
}
}

Answers (2)