Hey, My problem is that when i try to insert a GridView in ASP.NET webpage it doesn't appear in the Browser.
A:
You need to bind data to it for it to display. No data and it will not display anything.
Try this (assuming you have AutoGenerateColumns
on):
yourGrid.DataSource = new List<string>() { "Test1", "Test2", "Test3" };
yourGrid.DataBind();
If you still get no data, check to see that the control's Visible
property is not set to false
. Also make sure that no parented controls that the GridView
is contain in are set to hidden as well.
You can also try setting the EmptyDataText
property on your GridView
:
<asp:GridView ID="yourGrid" runat="server" EmptyDataText="No data" ...
EDIT: (based on comment)
Dim DR As OleDbDataReader = Command.ExecuteReader()
yourGridNameHere.DataSource = DR
yourGridNameHere.DataBind()
Kelsey
2010-05-21 16:04:05
dotNET
2010-05-21 17:22:47
@AZIRAR Assign the created `DataReader` DR to the `GirdView` `DataSource` property and then call `DataBind` on the `GirdView`. I will update the answer.
Kelsey
2010-05-21 17:52:57
It's working perfectly, thank you.
dotNET
2010-05-21 17:55:24
@AZIRAR If this answer helped you please mark it as the Accepted Answer. Thanks
Kelsey
2010-05-21 17:57:22
Done. thank you.
dotNET
2010-05-21 17:58:33