By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

GridView Data Binding

P: 7
Hi again.

I have questions to ask.

1. It's not necessary that I write codes to bind the database to the gridview?

2. Why is it that when I try to view the gridview in the browser it shows me a blank page? How to overcome that? Write codes...? If it is true that we have to include codes, how to code? Because currently there is no data in the database for the gridview and when I attempt to view it, it gives me a blank page.

Jan 7 '09 #1
Share this Question
Share on Google+
3 Replies

P: 344
Yes, because there are no rows in your database, it gives a blank page.
Insert a row or more in your database using the database management system IDE, if it SQL Server so use the management studio SSMS or Visual Studio to do so, and you can type an insert statement to your database.
Jan 7 '09 #2

Expert Mod 5K+
P: 9,731
If you don't use the DataBind method to bind the data to your GridView then your GridView will contain no data to display and therefore will not be displayed.

Once you have created a data source for your GridView set the GridView's DataSource Property and the call the GridView's DataBind method to bind this data to the GridView. If the source contains data then your GridView will be displayed in the page, otherwise it will not be displayed.
Jan 13 '09 #3

P: 68
Check out this:Display gridview header when no data is present.
This post suggests the way to display gridview header when there is no data present in the gridview.
Jan 22 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.