views:

34

answers:

1

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
dotNET
@AZIRAR Assign the created `DataReader` DR to the `GirdView` `DataSource` property and then call `DataBind` on the `GirdView`. I will update the answer.
Kelsey
It's working perfectly, thank you.
dotNET
@AZIRAR If this answer helped you please mark it as the Accepted Answer. Thanks
Kelsey
Done. thank you.
dotNET