ASP.NET C# BindGrid?

Okay, I've tried the infamous 'BindGrid' method with both VS 2003 Intellisense and manually, however I cannot seem to get a DataGrid to show on page_load. I've also noticed that Intellisense doesn't always include all the code sometimes. I simply have a Dataset filling a datagrid.

private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
BindGrid();
}                  
}

private void BindGrid()
{
string SQL="Select * FROM DataBaseTable";  
cn = new SqlConnection(ConfigurationSettings.AppSettings["AppSqlCon"]);
SqlCommand cmd= new SqlCommand(SQL,cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
cn.Open();
da.Fill(dataSet1, "datasetTable");
DataGrid1.DataSource = dataSet1.Tables["datasetTable"].DefaultView;
DataGrid1.DataBind();
}
cn.Close();

LVL 1
kvnsdrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

martie_11Commented:
What happens?  Do you get an error or just a blank screen?
kvnsdrAuthor Commented:
Just a blank screen.
martie_11Commented:
Can you paste the HTML from the ASPX page?

Thanks.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Anandhi KAssociate DirectorCommented:
If you use BoundColumns for displaying, Have you given the DataField Property which is nothing
but the column that has to displayed in the DataGrid
<asp:BoundColumn HeaderText = "XXXX" DataField=<DataTable ColumnName>>
(Or)
If you want to bind the dataTable to the Grid give AutoGenerateColumns="True" while
defining datagrid

If these 2 are not solns. can you post Aspx page coding?
NetSlutCommented:
Make sure there is this line included in

private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load);

}

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NetSlutCommented:
sorry , my comment wasnt finished yet.

Make sure this line " this.Load += new System.EventHandler(this.Page_Load); "

is included in the InitializeComponent() of the codebehind page.

Visual studio will often remove this line, so Page_Load won't be called and you keep getting a blank page.

This is a known (and very fun) bug in visual studio. :-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.